this is the code that i have tried for making a Bluetooth phone controlled longboard.
the errors are beyond me, can anyone help?
code:
void setup()
{
int LED= 12;
char input;
}
Serial.begin(9600);
pinMode(LED, OUTPUT);
Serial.println(">> START<<");
{
if(Serial.available()>0)
{
input= Serial.read();
if(input=='1')
{
Serial.println("ON");
digitalWrite(LED, HIGH);
delay(2000);
}
else if(input=='0')
{
Serial.println("OFF");
digitalWrite(LED, LOW);
delay(2000);
}
else
{
Serial.println("NO INPUT");
Serial.println(input);
}
}
}
errors:
Arduino: 1.6.9 (Windows 10), Board: "Arduino/Genuino Uno"
electric_longboard_v1:7: error: 'Serial' does not name a type
Serial.begin(9600);
^
electric_longboard_v1:8: error: expected constructor, destructor, or type conversion before '(' token
pinMode(LED, OUTPUT);
^
electric_longboard_v1:9: error: 'Serial' does not name a type
Serial.println(">> START<<");
^
electric_longboard_v1:11: error: expected unqualified-id before '{' token
{
^
exit status 1
'Serial' does not name a type
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
electric_longboard_v1.ino (552 Bytes)