gatArduinOSEK.ino example 1

This file is an example of a main file in an Arduino project

Additional files

  • Additional files with gttc_ prefix are the gatArduinOSEK files, not to be modified in normal use.
  • Additional files with prj_ prefix are the ones that must be configured for each project, they are part of the example.

Project Functionality

  • This project uses N_BUTTONS buttons and N_LEDS leds and the serial port of the arduino.
    • When using direct GPIO devices: N_BUTTONS=N_LEDS=4. Led states are ON and OFF. Buttons and leds are connected to pins configured in prj_pinout.h
    • When using TM1638 device: N_BUTTONS=N_LEDS=8. Led states are OFF, ON (GREEN) and ON (RED).
  • If not using I2C to communicate:
    • Buttons are read and the statuses are sent through the serial console broadcast.
    • The user can send commands through the serial console to change the leds states.
    • The broadcast is donde periodically.
    • The serial commands are detected using polling.
  • If using I2C to communicate:
    • Arduino configured as an slave.
    • Master sends commands through I2C requests (not serial console) to change led states.
    • Slave (arduino) gives the button states as the response to the request.
    • Handling for requests or responses is done through callback functions.
  • Global variables of the project are shared through a DRE (Data Runtime Environment) defined in prj_dre.h and prj_dre.c
  • The console commands are processed in prj_tty_cmds.h and prj_tty_cmds.c
  • The console broadcast of the input statuses is done in prj_tty_brcast.h and prj_tty_brcast.c
  • Please visit the wiki page for this project in http://gatatac.org/projects/gttcosarduino/wiki/GatArduinOSEKino_example_1