Beginner questions (e.g. counter, serial console...)

Hello!

Because I’m not familiar with Arduino and programming here are my questions:

Is there a serial monitor like in Arduino software? It seems the console will not send when “dump” is set to “never” an the input string changes.

Has the counter a upper and lower limit? It would be helpful for me to have a counter where I can set the limits (e.g. -100…+100 or 0…+255)

Which frequency and pulse pause ratio has the node “continuously”?

Is there a serial monitor like in Arduino software? It seems the console will not send when “dump” is set to “never” an the input string changes.

console-log only sends to the console on a pulse (or only at boot, or on every clock: “continous”). You could hook a clock to it. I wrote awg/conversions/data-to-pulse pretty much just for this case (see my https://github.com/awgrover/xod_lib).

I assume you figured out that you have to use the Arduino IDE (or something else) to see the console?

Has the counter a upper and lower limit? It would be helpful for me to have a counter where I can set the limits (e.g. -100…+100 or 0…+255)

Yes. It counts from 0 to max and then rolls over to min. And, I don’t know what type “Number” is, in this case. I’d guess it rolls over to a negative number and then counts back up. If integer, that’s 2^32. Of course, “RST” will reset it to 0.

I wrote awg/count/count just to do what you want. See my https://github.com/awgrover/xod_lib .

Which frequency and pulse pause ratio has the node “continuously”?

It tries to pulse as fast as it can. For small programs, that could be much faster than once per clock. On large programs, it could be slower. Specifically, it’s once per transaction (see https://xod.io/docs/guide/execution-model/)

Hello awgrover, thanks for your fast reply!

I assume you figured out that you have to use the Arduino IDE (or something else) to see the console?

Yes, Arduino console works and other terminal programs like hterm also. Now I understand the function of “console-log”! It must be triggered by a seperate source to send a string.

I wrote awg/count/count just to do what you want. See my https://github.com/awgrover/xod_lib .

There is “any.cpp” and “patch.xodp” in this folder. Can I load this into XOD-IDE? How is this done?

My English is not very good, very sorry about that. :cry: Hope you will understand what I mean. The target is to realize a counter that starts from a defined value (e.g. “0”) and stops at another defined value (e.g. 100). Two buttons start the trigger pulses and switch between incremental an decremental counting.

The preferred method would be to put any & patch in the xod workspace, in the lib:

$xodworkspace/lib/awg/count/count

I need to make installation easier, sorry I haven’t worked on it. You could use the “clone or download” button, get the zip, unzip, and move the “awg” directory inside your $xodworkspace/lib.

Then, it’s accessible to any project from the lib list.

It’s possible to put the files in a project, as a “patch”. Maybe like $xodworkspace/$yourproject/count. You could make the patch in XOD, then copy/download just the 2 files to that patch’s directory.

You could use the “clone or download” button, get the zip, unzip, and move the “awg” directory inside your $xodworkspace/lib.

It works! Thanks a lot for your support awgrover!

Hello awgrover, one more question to your counter node:

This is my project:

As long as button one is pressed the counter counts up (START = 0; LIMIT = 100). When Button 3 is pressed the counter counts down. Button 2 sets the counter to zero.

After uploading the project to my Arduino both buttons (1 + 3) make the value increasing. Did I make a mistake?

Is there a way to stop the counter at the limits even when the button is longer pressed?

Nope. It uses a real number (4-byte IEEE754 float) so the node counts infinitely in theory. On practice, it will loose integral precision after 2^16 (if you count by ones, you’ll start to get not really integer numbers after this point). Then somewhere very far it would switch to +Infinity value and stay there.

I made a guess as to how my “count” should work. You had a different idea. My guess was that start…limit was the direction, and “step” was always in that direction. In fact, I force step to be positive internally. I thought that might make less mistakes for people. But, maybe that was a bad idea.

To get reversing direction with my current “count”, you would have to switch start and limit (instead of +/- 1 for step). I tried to test that, but it is more complex than I thought.

The developers are working on a way so you could make your own “range” like thing, but it takes c++ for now.

No, I hadn’t thought of it that way. My “count” is really a “cycle”.

Hmmm… Looks similar to the xod/core/fade node.