Open MichaelMGonzalez opened 7 years ago
If you have a main() function defined elsewhere or you want do define your own main() function you can include only the Piduino header. e.g.
#include "piDuino.h"
int ledPin = 4; // GPIO4
void setup() {
pinMode(ledPin, OUTPUT);
}
void loop() {
printf("LED ON\n");
digitalWrite(ledPin, HIGH);
delay(1000);
printf("LED OFF\n");
digitalWrite(ledPin, LOW);
delay(1000);
}
int main () {
setup();
while(1){
loop();
}
return (0);
}
You can check this webpage for more information: http://nvsl.github.io/PiDuino_Library/
I tried compiling an existing Arduino library with the following commands
g++ gave me the following erros
Inspecting the assembly showed that a main label was created for each object file
Within piduino's Arduino.h file, it seems to provide a full definition for main().
https://github.com/NVSL/PiDuino_Library/blob/master/Arduinoh/Arduino.h#L36