Hi !
I want to create some extension for control an arduino robot for my students(middle school), but when I’m uploading on arduino uno the blocks program I have the compile error :
"In function ‘void setup()’: C:\Users\Vincent\mblock-avr\temp\build\code.cpp:28:3: error: a function-definition is not allowed here before ‘{’ token { ^
Failed to compile file code.cpp
arduino build failed."
the ArduinoC code is
#include <Arduino.h>
#include <Wire.h>
#include <SoftwareSerial.h>
void _delay(float seconds) {
long endTime = millis() + seconds * 1000;
while(millis() < endTime) _loop();
}
void setup() {
void goduringandcorrection(double pcent, double fac, double nsec)
{
analogWrite(5,(pcent255)/100); //convert PWM value to %
digitalWrite(6,0); //left motor go ahead
digitalWrite(7,1); //
analogWrite(10,((pcent255)/fac)/100); // corecting one motor if imbalance
digitalWrite(8,0); //right motor go ahead
digitalWrite(9,1); //
_delay(nsec);
analogWrite(5,0); // stop left
analogWrite(10,0); // stop right
}
}
void _loop() {
}
void loop() {
_loop();
}
Thanks a lot for your answers !!!