Go Down

Topic: VVVV tutorial problem (Read 1 time) previous topic - next topic

acrossell

Mar 16, 2011, 04:56 pm Last Edit: Mar 16, 2011, 05:25 pm by acrossell Reason: 1
Hello,

Im currently completing tutorials on interfacing vvvv with arduino (http://vvvv.org/documentation/arduino03) but am having a problem compiling the code given with the tutorial but i have little arduino or c experience, could anyone give me an ide of why when I compile the code I receive the following errors.

Thank you in advance

update: i believe the error lies in the syntax for writing numbers in c, am i correct in thinking that the values used in this sketch are ascii when arduino is expecting an octal number? if so can anyone link me to a page that may explain how this works?

sketch_mar16b:41: error: stray '#' in program
sketch_mar16b:44: error: stray '#' in program
sketch_mar16b.cpp:48:19: error: invalid digit "9" in octal constant
sketch_mar16b:44: error: stray '#' in program
sketch_mar16b.cpp:48:26: error: invalid digit "9" in octal constant
sketch_mar16b.cpp: In function 'void loop()':
sketch_mar16b:41: error: lvalue required as unary '&' operand
sketch_mar16b:41: error: expected `)' before ';' token
sketch_mar16b:41: error: expected primary-expression before ')' token
sketch_mar16b:41: error: expected `;' before ')' token
sketch_mar16b:44: error: 'else' without a previous 'if'
sketch_mar16b:44: error: expected `)' before ';' token
sketch_mar16b:44: error: 'L' was not declared in this scope
sketch_mar16b:44: error: expected primary-expression before ')' token
sketch_mar16b:44: error: expected `;' before ')' token


Code: [Select]



/* send/recieve data to/from vvvv
* -----------
*
* poti --> arduino --> vvvv --> arduino --> control LED
* 17-01-2006
* copyleft 2006 benedikt gross
*
* Last edit Westbam 20-08-2009, for new Serial. code.
*
*/

int potPin = 5; // select the input pin for the potentiometer
int ledPin = 13; // select the pin for the LED
int val,serialGet = 0; // variable to store the value coming from the sensor/serial port (from vvvv)
int delaytime = 1; // delay time for the main loop


void setup() {
pinMode(ledPin, OUTPUT); // declare the ledPin as an OUTPUT
Serial.begin(9600); // use the serial port to send/recieve values to/from the computer
}

void loop() {
val = analogRead(potPin); // read the value from the potentiometer

Serial.print (val); // print the value to the serial port
//linebreak
Serial.write(10);
Serial.write(13);

// read the serial port
serialGet = Serial.read();

// if the input is '-1' then there is no data
// at the input, otherwise store it
if (serialGet != -1) {
val = serialGet;
}

// if the stored value is 'H' turn the LED on
// if the stored value is 'L' turn the LED off
if (val == 'H') {
digitalWrite(ledPin, HIGH);
}
else if (val == 'L') {
digitalWrite(ledPin, LOW);
}

delay(delaytime);
}

PaulS

Code: [Select]
// if the input is '-1' then there is no data
// at the input, otherwise store it
if (serialGet != -1) {
val = serialGet;
}

// if the stored value is 'H' turn the LED on
// if the stored value is 'L' turn the LED off
if (val == 'H') {

Those ' strings don't look right. Are they supposed to be ' characters? Look at the code on the web site.

Coding Badly

ARGH!  I just responded to this same post in another section.

@acrossell: PLEASE DO NOT MULTIPOST!  You have wasted my time and PaulS's time.

acrossell

sorry, first post on the forum and thought I may have posted in the wrong section after seeing the dedicated coding forum, wont happen again.

Go Up