Pages: [1]   Go Down
Author Topic: VVVV tutorial problem  (Read 1557 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 25
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:


/* 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);
}
 
« Last Edit: March 16, 2011, 11:25:06 am by acrossell » Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 653
Posts: 50912
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
// 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.
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13085
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 25
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: