Arduino not working

Discussion in 'Arduino IDE' started by objectr, Nov 29, 2014.

  1. objectr

    objectr Member

    Joined:
    May 28, 2014
    Messages:
    36
    Likes Received:
    1
    HI guys,

    I have a problem with my udoo. When I upload the following sketch on my Udoo, it's not doing anything.(it's not sending back any serial data nor does it turn on/ dimm the led) I tested the sketch on other Arduinos and it always worked without any problems.
    A very simple sketch that prints a word in the serial monitor works though.
    also the LED blink sketch works without problems.

    thanks!!

    Code:
    int led1 =11;
    int led2 =10;
    int led3 =9;
    String readString;
    
    void setup() {
    Serial.begin(115200);
    pinMode (led1, OUTPUT);
    pinMode (led2, OUTPUT);
    pinMode (led3, OUTPUT);
    
    }
    
    void loop() {
    
    if (Serial.available()) {
    char c = Serial.read(); 
    if (c == ',') {
    if (readString.length() >1) {
    
    int n = readString.toInt();
    
    if(readString.indexOf('a') >0) {
    analogWrite(led1, n);
    }
    if(readString.indexOf('b') >0) {
    analogWrite(led2, n);
    }
    
    if(readString.indexOf('c') >0) {
    analogWrite(led3, n);
    
    }
    }
    readString=""; 
    }
    
    else {
    readString += c; 
    }
    }
    Serial.flush();
    }
     
  2. xwalter

    xwalter Member

    Joined:
    Sep 8, 2014
    Messages:
    89
    Likes Received:
    4
    to write back it needs Serial.write(...) or Serial.printl()...where are they?
    try to use the terminal by ARduino Ide and send some characters and then try to understand what is hannened
     

Share This Page