I bought the Arduino Starter kit, which came with a book of different projects, and how to do them. On Project 11 (Crystal Ball), I typed in the provided code, but when I tried to compile/verify it, I got a rather confusing error message.
Here's the code:
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
const int switchPin = 6;
int switchState = 0;
int prevSwitchState = 0;
int reply;
void steup() {
lcd.begin(16, 2);
pinMode(switchPin, INPUT);
lcd.print("Ask the");
lcd.setCursor(0, 1);
lcd.print("Crystal Ball!");
}
void loop() {
switchState = digitalRead(switchPin);
if (switchState != prevSwitchState) {
if (switchState == LOW) {
reply = random(8);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("The Ball says:");
lcd.setCursor(0, 1);
switch(reply) {
case 0:
lcd.print("Yes");
break;
case 1:
lcd.print("Most likely");
break;
case 2:
lcd.print("Certainly");
break;
case 3:
lcd.print("Outlook good");
break;
case 4:
lcd.print("Unsure");
break;
case 5:
lcd.print("Ask again");
break;
case 6:
lcd.print("Doubtful");
break;
case 7:
lcd.print("No");
break;
}
}
}
prevSwitchState = switchState;
}
And here's the error message:
core.a(main.cpp.o): In function `main':
/Users/boys/Downloads/Installations/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/main.cpp:11: undefined reference to `setup'
I looked over the code to see if I'd typed anything wrong, But as far as I can tell, the code is essentially the same as it is in the book.
Where did I mess up? What can I do to fix it? AND WHAT DOES THAT ERROR MESSAGE MEAN???
Thanks, all.