Serial Issues and Arduino

I am taking this in baby steps before I get to the true programming of my art piece.
I open my serial open like this in setup()

serial.setup(“dev/tty.usbserial-A40014fE”, 9600);

and in update()
serial.writeByte(’!’);

the Arduino program is a serial.read and then a serial.println to see if it is working. I get a whole lot of -1 which means I am not connecting.

I probably am missing something very simple.

Hey,

I am getting the same issue on Windows using Code::Blocks. I have even downloaded premade patches made in VVVV and MaxMSP with the same issues. Seems I can’t send messages or receive messages with the Arduino.

I was using the new release of oF and I wasn’t getting a response from the Arduino and then moved to the previous release with ofStandardFirmata with the same results.

I made some progress in the past few days but it seems that the only port I can send messages to is digital port 0 (RX). This is not very useful for controlling RGB lighting though :frowning:

There is one problem though when I set the pins to the ones above. The light just shines white. I set the mouse to send PWM messages to one of the channels of the RGB LED but it only flashes and turns back to white again. Even if I only set up one of the pins then the RGB LED only shines one color.

I will update if I manage to get the light working properly

I have finally got it working.

All I had to do was to load the Standard Firmata example from the Arduino IDE into the arduino. But, you have to edit something in the setup area of the program.

You need to change :

  
Firmata.begin(57600);  

TO

  
Firmata.begin(19200);  

Then, when you are making a patch, you should put write :

  
void usbTest::setup() {  
  
    arduino.connect("COM1", 19200); // Change COM1 to your port/device  
  
    ofSleepMillis(4000); \\ Makes sure that the arduino doesn't connect straight away. May not connect otherwise  
  
    printf("\n\n");  
  
    if(arduino.isArduinoReady()>0) {  
        printf("Serial port open\n\n"); \\ To check if the port is open  
        arduino.sendDigitalPinMode((PIN, ARD_PWM);  
}  

Now you can test o see if signals are being sent by using the mouse as a controller and seeing if your arduino processes your actions

Hope this has helped :slight_smile: