Change databits from 8bit to 10bit in the serial object

    Nov 27 2021 | 10:44 pm
    Hi, I try to feed a arduino with input up to 1023 via the serial object. I can input values up to 1023, but in the Arduino serial monitor there are only numbers up to 255. So i thought it would be something about the databits. When i use the serial object, i can only choose between 5-8bit, but i would need 10bit. Is there a possibility to do this? Thanks a lot for your help Best, John

    • Nov 28 2021 | 3:34 pm
      you insert atoi and parse that in arduino.
      if you need to send line feed then
      By the way , max serial object and arduino serial monitor can't use board at same time
    • Nov 28 2021 | 7:52 pm
      Thanks a lot for your help. I think I realised it ain't that easy as i thought. I read further and realised that it's only possible to send values (integer?) from 0-255. So i need to need to create a string? which contains several values. And then i need to interpret them in arudino back to the original number. E.g. I want to send the value 1000. I would need a string that contains 255,255,255,235 and then interpret it in arduino back to the orginal value of 1000. Perhaps you can give me some hinds what to read? I'm still very new to this topic. Here are some screenshots of what happens when i tried your solution. And to add something to the context. I need this analogWrite to control a motor with a voltage of 1v to 2.5v in very small steps. The motor driver allows to interpret 10bit resolution.
    • Nov 29 2021 | 8:26 am
      it is simpler than that, for single int this is all it needs: void setup() {Serial.begin(9600);}
      void loop() { if (Serial.available() > 0){
      int AN1 = Serial.parseInt();
      if ( == '\n') {analogWrite(A0, AN1);}
      // this writes received int to analog output A0
      in Max you need to send line feed as shown in second screenshot I posted. ---- If you need something more complex, or several ints then rather post the whole story.
    • Nov 29 2021 | 9:03 am
      P.S. I overlooked the motor control part at the end. You know that analogWrite outputs PWM signal, and to produce voltage one needs either some sort of low pas filter, in simplest form resistor - capacitor, but much better would be to use digital pot and so regulate output voltage precisely. Can't say more without knowing details about that motor and driver. But - analogReadResolution is wrong thing to set. That affects only analog Input read resolution. You need AnalogWriteResolution if you have board that supports it. read this :
    • Dec 02 2021 | 6:48 pm
      Wow, works perfectly! :) Thank you so much And i think i even know how it works.