Hello, I am having some issues that I cannot figure out. I tried posting on the Arduino forums, but they suggested posting here instead.
I have an Arduino Uno (the basic one) and am running this code:
Arduino:
- void setup(){
- Serial.begin(9600);
- }
- void loop(){
- float a = -4.56789;
- a /= random(10);
- Serial.println(a, 5);
- delay(500);
- }
Processing:
- import processing.serial.*;
- Serial myPort;
- float value;
- void setup()
- {
- myPort = new Serial(this, Serial.list()[0], 9600);
- }
- void draw()
- {
- }
- void serialEvent(Serial p) {
- // get message till line break (ASCII > 13)
- String message = myPort.readStringUntil(13);
- if(message != null){
- value = float(message);
- println(value);
- }
- }
This works fine. Processing will print the float coming in from Arduino/Serial. I have also tried uploading StandardFirmata to the Uno board and then running a Processing sketch with Serial/Arduino libraries which also worked fine.
I then unplug my Uno board and plug in my new Arduino Micro board in, upload the Arduino code, and run the Processing code. It is strange because there are no errors or anything, it just reacts as if there are no SerialEvents at all. Just nothing happens. I can print to the console Serial.list() and the correct port comes up, but nothing is read on Processing's side from Arduino.
I cannot figure out why this would be. Anyone have any ideas?
Thanks.