I'm building the Carduino project from the instructables site and I'm having trouble with the library. The zip file has a .h file, a .cpp file and a bunch of example .ino files. I have no idea what I'm doing. I import the library and it just says #include <Carduino.h>
When I drag and drop the .cpp file, it imports but when verifying it gives this error message:
core.a(main.cpp.o): In function main': C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/main.cpp:11: undefined reference to
setup'
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/main.cpp:14: undefined reference to `loop'
The code for the .cpp file is as such:
#include <Carduino.h>
#include "Arduino.h"
#include "Carduino.h"
void Carduino::begin()
{
pinMode(12, OUTPUT);
pinMode(9, OUTPUT);
pinMode(13, OUTPUT);
pinMode(8, OUTPUT);
}
void Carduino::goforward(float seconds, int speed)
{
digitalWrite(12, HIGH);
digitalWrite(9, LOW);
analogWrite(3, speed);
digitalWrite(13, HIGH);
digitalWrite(8, LOW);
analogWrite(11, speed);
delay(seconds*1000);
digitalWrite(9, HIGH);
digitalWrite(8, HIGH);
}
void Carduino::goback(float seconds, int speed)
{
digitalWrite(12, LOW);
digitalWrite(9, LOW);
analogWrite(3, speed);
digitalWrite(13, LOW);
digitalWrite(8, LOW);
analogWrite(11, speed);
delay(seconds*1000);
digitalWrite(9, HIGH);
digitalWrite(8, HIGH);
}
void Carduino::turnright(int time)
{
digitalWrite(12, LOW);
digitalWrite(9, LOW);
analogWrite(3, 1023);
digitalWrite(13, HIGH);
digitalWrite(8, LOW);
analogWrite(11, 1023);
delay(time);
digitalWrite(9, HIGH);
digitalWrite(8, HIGH);
}
void Carduino::turnleft(int time)
{
digitalWrite(12, HIGH);
digitalWrite(8, LOW);
analogWrite(3, 1023);
digitalWrite(13, LOW);
digitalWrite(9, LOW);
analogWrite(11, 1023);
delay(time);
digitalWrite(9, HIGH);
digitalWrite(8, HIGH);
}
int Carduino::proximity()
{
int reading = analogRead(2);
float volts = reading0.0048828125;
float distance = 65pow(volts, -1.10);
return distance;
}
My question is basically what am I supposed to import? All the files? What's with the error message? What am I even doing? I included the zip file to this post so maybe someone can look at it and tell me what I'm supposed to do?
F4IJ6J1H27LSA96.zip (3.38 KB)