You have quite a few misspellings in that code, and it wouldn't run anyways.
Arduino code is very similar to C++, except it doesn't have the Standard Template Library, and it does have a few special functions for interacting with your Arduino board.
The first thing you want to do in an Arduino program is set the pin numbers that you will be using. I recommend using #define for this. In your code for example you would want:
1 2
|
#define sensorPin 0
#define buzzerPin 9
|
This acts the same way as #define in C++. All it does is tell the compiler to replace every instance of "buzzer" with the number 9. The pin numbers you want to use will be different depending on what type of Arduino board you have, so make sure you're using the right ones.
After you have defined the numbers for the pins you are going to use, you have to initialize those pins. This goes before the main function and looks as so:
1 2 3 4 5
|
void setup ( )
{
pinMode ( sensorPin, INPUT );
pinMode ( buzzerPin, OUTPUT );
}
|
The main function in Arduino is not main(), but loop(). It is a void function, and as its name implies, its contents will loop forever. This is where things get more complicated and I can't be much help. With C++, everyone has the same code to use. With Arduino, the code you use depends on the physical components you have. A potentiometer I used once had a range of 0 to 1023, but yours may be completely different. The way yours works should be detailed somewhere, and you'll have to figure that out yourself.
To get data from your devices you need to use either analogRead() or digitalRead().
To send data to your devices you need to use either analogWrite() or digitalWrite().
Variables are defined the same way as in C++.
Loops and if..else statements are the same as well.
To make your code pause for 500 milliseconds, use:
delay ( 500 );
If you need help on how to use any of these functions, it's all described on the Arduino website:
http://arduino.cc/en/Reference/HomePage