osd-contiki/examples/osd/arduino-sketch
Ralf Schlatterbeck e65dabb119 Add Arduino compatibility layer
We can now directly compile arduino sketches (.pde) files.
Arduino compatible analogWrite works now.
But there is still a long way to go, serial I/O and timer stuff (delay,
millis etc) currently don't work (not tested but I don't expect this to
work).
It can be used in an arduino sketch or in a normal contiki program.
We get a PWM frequency of 490.2 Hz (a period of 2.040 ms), that's
Arduino compatible. If you need different frequencies see native timer
usage in examples/osd/pwm-example
In a contiki program you have to call arduino_pwm_timer_init to
initialize the timer before pwm works. The arduino sketch wrapper
already does this.
For running a sketch, see examples/osd/arduino-sketch
2014-06-26 11:00:01 +02:00
..
arduino-example.c Add Arduino compatibility layer 2014-06-26 11:00:01 +02:00
flash.sh Add Arduino compatibility layer 2014-06-26 11:00:01 +02:00
led_pwm.h Add Arduino compatibility layer 2014-06-26 11:00:01 +02:00
Makefile Add Arduino compatibility layer 2014-06-26 11:00:01 +02:00
project-conf.h Add Arduino compatibility layer 2014-06-26 11:00:01 +02:00
README.md Add Arduino compatibility layer 2014-06-26 11:00:01 +02:00
resource_led_pwm.c Add Arduino compatibility layer 2014-06-26 11:00:01 +02:00
run.sh Add Arduino compatibility layer 2014-06-26 11:00:01 +02:00
sketch.pde Add Arduino compatibility layer 2014-06-26 11:00:01 +02:00

Arduino compatibility example

This example shows that it is now possible to re-use arduino sketches in Contiki. This example documents the necessary magic. Arduino specifies two routines, setup and loop. Before setup is called, the framework initializes hardware. In original Arduino, all this is done in a main function (in C). For contiki we define a process that does the same.

See the documentation file in apps/contiki-compat/README.md