The steps objectives are the following:
- Goes from plain C to library;
- Use the Arduino C/C++ library to code the feature;
- Abstracting low-level I/O call through function calls.
The blinking LED example, levelled up.
Here is a starting code example to make the link blink using the Arduino library:
#include <avr/io.h>
#include <util/delay.h>
#include <Arduino.h>
int led = 13;
boolean led_on;
void setup() {
pinMode(led, OUTPUT);
led_on=true;
}
void change_state_led(){
if (led_on){ digitalWrite(led, LOW); }
else { digitalWrite(led, HIGH);}
led_on = !led_on;
}
int main(void){
setup();
while(1)
{
change_state_led();
_delay_ms(1000);
}
return 0;
}
Expected Work
- Explore the Arduino library reference (https://www.arduino.cc/en/Reference/HomePage)
- Implement the two parts of the application using the library
Stepback questions
- Is the readability problem solved?
- What kind of parallelism can still be expressed?
- Who is the public targeted by this “language”?
- Is this language extensible enough to support new features?
- What is the price for the developer?