Serial Message Chopped

edited June 2017 in Arduino

Hi All,

I am using the default SimpleSerialRead example. I verified the serial is working on Arduino Monitor/ Putty and set the baud rate to 250000. I am only getting 2-digit numbers by println() to console instead 4 digit numbers with other serial monitor. I also tried to slow the baud rate to 115200. Still not working.

Tagged:

Answers

  • Please provide ino and pde code showing your approach.

    Kf

  • edited June 2017

    commented code is the arduino code

        /**
         * Simple Read
         * 
         * Read data from the serial port and change the color of a rectangle
         * when a switch connected to a Wiring or Arduino board is pressed and released.
         * This example works with the Wiring / Arduino program that follows below.
         */
    
    
        import processing.serial.*;
    
        Serial myPort;  // Create object from Serial class
        int val;      // Data received from the serial port
    
        void setup() 
        {
          size(200, 200);
          // I know that the first port in the serial list on my mac
          // is always my  FTDI adaptor, so I open Serial.list()[0].
          // On Windows machines, this generally opens COM1.
          // Open whatever port is the one you're using.
          String portName = Serial.list()[0];
          myPort = new Serial(this, portName, 250000);
        }
    
        void draw()
        {
          if ( myPort.available() > 0) {  // If data is available,
            val = myPort.read();         // read it and store it in val
            println(val);
          }
    
        }
    
    
    
        /*
    
        // Wiring / Arduino Code
        // Code for sensing a switch status and writing the value to the serial port.
    
        void setup() {
          Serial.begin(250000);                    // Start serial communication at 9600 bps
        }
    
        void loop() {
            val = analogRead(3);    // read the input pin
    
          Serial.println(val);             // debug value
        }
    
        */
    
Sign In or Register to comment.