1

I am using a Raspberry Pi and Arduino (for 433Mhz switched).

My arduino code (short):

void loop() {
    if (Serial.available() > 0) {
        // read the incoming byte:
        incomingByte = Serial.read();
        if (incomingByte == 49){
            transmitter.sendUnit(0, true);
        }
        if (incomingByte == 50){
            transmitter.sendUnit(0, false);
        }
        if (incomingByte == 51){
            transmitter.sendUnit(1, true);
        }
        if (incomingByte == 52){
            transmitter.sendUnit(1, false);
        }
    }
}

However I can not send info to the arduino using serial usb connection from the pi (it does work from the serial monitor..)

usbadr = '/dev/ttyACM0'
ser = serial.Serial(usbadr, 9600)
ser.write(chr(49))
  • I'm not particularly familiar with your problem, but I would suggest replacing the middle series of if statements with an else-if block. – Jacobm001 May 15 '15 at 22:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.