Need some help

The situation:
In march I have to present a work for school.. it's named 'robotics for dummies'. Using the arduino I want to controll a RC-model car (the RC part replaced by the arduino and some other electronics). To keep it simple, I'm only using 3 microswitches (2 in front, and 1 in the back).

The problem:
I don't have the arduino YET! It will arrive in february. So I'm very short in time...
I've read a couple of tutorials and I'm already trying to make the program before I have the arduino.
But I might need some help since I can't test the program.

I'll translate a few comments from dutch to english. But if there is someone that speaks dutch, prepared to help me I would be verry happy!

The code:

 *  RC-auto Versie 0.1
 *  Tokesnugerd - Eindwerk Salco Haasrode '07/'08
 *  Dit programma moet de auto in staat stellen om door middel -> description what the program should do
 *  van 3 druksensoren rond te rijden zonder vast te steken. -> description what the program should do
int Slv = #pin;        // Pin where the front left switch is connected to
int Srv = #pin;        // Pin where the front right switch is connected to
int Sa  = #pin;        // Pin where the rear switch is connected to

void setup() {
  Serial.begin(9600);   // Prepare serial
  pinMode(Slv, INPUT);  // Slv is input
  pinMode(Srv, INPUT);  // Srv is input
  pinMode(Sa, INPUT);   // Sa is input
  Serial.println("Ik start het programma!");  // Says that program is starting

void BOTSlv() {                                    
  Serial.println("Ik ben links vanvoor gebotst!"); // Send message that there has been a collision front left

void BOTSrv() {                                     
  Serial.println("Ik ben rechts vanvoor gebotst!"); // Send message that there has been a collision front right

void BOTSa() {                                        
  Serial.println("Ik ben rechts vanachter gebotst!"); // Send message that there has been a collision rear

void loop() {
  if (digitalRead(Slv) == LOW){  // front left collision
  if (digitalRead(Srv) == LOW){  // front right collision
  if (digitalRead(Sa) == LOW){  // rear collision

That's all.. as you can see there isn't much about it.. but I want to be sure that the basics aren't full of errors!
May I post here another version when that one is completed ?


You can install and run the Arduino IDE without a board to check the syntax of your

The sketch you posted is a good start. You do have an error in the initialisation of the variables defining the pins, (#pin needs to be replaced with a number representing the digital pin you want to read)

Good luck!

That was one I was aware of :slight_smile: Its done counsciously (written correctly ?? :)) because I don't know the pins I will be using yet..
The next step is the motor movement..

The IDE doens't give any errors (when choosing a random number as a pin) so I think this should work ?

I suppose there isn't an emulator or something like that...

Thanks for your response !