I'm a beginner in coding and I'm trying my best to work with the sample code, but now I've come to an impass. Can someone tell me what I'm doing wrong with this? http://pastebin.com/cFscTs6d
I'm getting the error:
Wild_Thumper_Controller_Prototype.ino: In function 'void I2Cmode()':
Wild_Thumper_Controller_Prototype:357: error: a function-definition is not allowed here before '{' token
Wild_Thumper_Controller_Prototype:386: error: expected `}' at end of input
I've probably done something very stupid but that's why I'm posting in the begginers forum.
For reference here's my IOpins and Constants:
#define LmotorA 3 // Left motor H bridge, input A
#define LmotorB 11 // Left motor H bridge, input B
#define RmotorA 5 // Right motor H bridge, input A
#define RmotorB 6 // Right motor H bridge, input B
#define RCleft 0 // Digital input 0
#define RCright 1 // Digital input 1
// #define S0 2 // Servo output 00
// #define S1 4 // Servo output 01
#define S2 7 // Servo output 02
#define S3 8 // Servo output 03
#define S4 9 // Servo output 04
#define S5 10 // Servo output 05
#define S6 12 // Servo output 06
#define Battery A0 // Analog input 00
#define RmotorC A6 // Analog input 06
#define LmotorC A7 // Analog input 07
#define Charger 13 // Low=ON High=OFF
---------------Constants-----------
//=================================== MODE OF COMMUNICATIONS
#define Cmode 2 // Sets communication mode: 0=RC 1=Serial 2=I2C
#define Brate 115200 // Baud rate for serial communications
//=================================== RC MODE OPTIONS
#define Mix 1 // Set to 1 if L/R and F/R signals from RC need to be mixed
#define Leftcenter 1500 // when RC inputs are centered then input should be 1.5mS
#define Rightcenter 1500 // when RC inputs are centered then input should be 1.5mS
#define RCdeadband 35 // inputs do not have to be perfectly centered to stop motors
#define scale 12 // scale factor for RC signal to PWM
//=================================== BATTERY CHARGER SETTINGS
#define batvolt 487 // This is the nominal battery voltage reading. Peak charge can only occur above this voltage.
#define lowvolt 410 // This is the voltage at which the speed controller goes into recharge mode.
#define chargetimeout 300000 // If the battery voltage does not change in this number of milliseconds then stop charging.
//=================================== H BRIDGE SETTINGS
#define Leftmaxamps 800 // set overload current for left motor
#define Rightmaxamps 800 // set overload current for right motor
#define overloadtime 100 // time in mS before motor is re-enabled after overload occurs
//=================================== SERVO SETTINGS
#define DServo0 1500 // default position for servo0 on "power up" - 1500uS is center position on most servos
#define DServo1 1500 // default position for servo1 on "power up" - 1500uS is center position on most servos
#define DServo2 1500 // default position for servo2 on "power up" - 1500uS is center position on most servos
#define DServo3 1500 // default position for servo3 on "power up" - 1500uS is center position on most servos
#define DServo4 1500 // default position for servo4 on "power up" - 1500uS is center position on most servos
#define DServo5 1500 // default position for servo5 on "power up" - 1500uS is center position on most servos
#define DServo6 1500 // default position for servo6 on "power up" - 1500uS is center position on most servos
- Dan