10 years, 10 months ago.

Error using processing and mbed

Hello

import processing.serial.*; import org.mbed.RPC.*;

mbed mbed; PwmOut led1; PwmOut led2; void setup() { size(480, 120); smooth(); mbed = new SerialRxTxRPC("COM5", 9600); led1 = new PwmOut(mbed, mbedRPC.LED1); led2 = new PwmOut(mbed, mbedRPC.LED2);

}

void draw() { double Position = mouseX; double Brightness = (Position/480); if (mousePressed) { led1.write(Brightness); } else { led2.write(Brightness); } }

when i try to compile that code in processing the following error appears: Nullpointerexception and the led1 = new PwmOut(mbed, mbedRPC.LED1); appears in bold

Hello Vitor Silva,

use <<code>> <</code>> syntax for code snippets, Is import part of your C++ program? import keyword is not part of C++ syntax. Probably C-objective?

Regards,
0xc0170

posted by Martin Kojtal 28 Oct 2013
Be the first to answer this question.