Processing Error
in
Core Library Questions
•
1 year ago
Hi,
So I have the following code and when I run it, I get an error of:
|
Any ideas??
- import processing.serial.*; //Import the serial library into your sketch
- import cc.arduino.*; //Import the Arduino-Firmata library into your sketch
- Arduino arduino; //Create an instance of Arduino named arduino (can be any name)
- char e;
- int ledPin;
- char serial;
- Serial scope;
- String adaptor= "/dev/tty.usbmodem1a21";
- void portConnect(){
- int portNumber = 99;
- String [] ports;
- println(Serial.list());
- ports = Serial.list();
- for(int j = 0; j< ports.length; j++) {
- if(adaptor.equals(Serial.list()[j])) portNumber = j;
- }
- if(portNumber == 99) portNumber = 0;
- String portName = Serial.list()[portNumber];
- println("Connected to "+portName);
- scope = new Serial(this, portName, 9600);
- scope.bufferUntil(10);
- }
- void serialEvent(Serial scope) { // this gets called every time a line feed is received
- String recieved = scope.readString() ;
- println(recieved + " from serial port"); // show it at the bottom of the processing window
- // also do the stuff you want to do when you get things back from the arduino
- }
- void setup() {
- size(200, 200);
- print(arduino.list());
- arduino = new Arduino(this, Arduino.list()[0], 9600); //defines arduino our board and sets the communication rate
- arduino.pinMode(ledPin, Arduino.OUTPUT);
- }
- void keyPressed() {
- print(key);
- delay(10);
- switch (key) {
- case 'e':
- case 'E':
- scope.write('e');
- break;
- case 'i':
- case 'I':
- scope.write('i');
- break;
- case 'q':
- case 'Q':
- scope.write('q');
- break;
- }
- };
- void keyReleased() {
- delay(10);
- switch (key) {
- case 'e':
- case 'E':
- scope.write('z');
- break;
- case 'i':
- case 'I':
- scope.write('p');
- break;
- case 'q':
- case 'Q':
- scope.write('l');
- break;
- }
- };
Also part of the error is:
Jun 3 23:06:55 Mac-2.local java[782] <Error>: CGContextGetCTM: invalid context 0x0
Jun 3 23:06:55 Mac-2.local java[782] <Error>: CGContextSetBaseCTM: invalid context 0x0
Jun 3 23:06:55 Mac-2.local java[782] <Error>: CGContextGetCTM: invalid context 0x0
Jun 3 23:06:55 Mac-2.local java[782] <Error>: CGContextSetBaseCTM: invalid context 0x0
Please help
1