Skip to content

Instantly share code, notes, and snippets.

@martinribelotta
Last active March 22, 2018 02:42
Show Gist options
  • Save martinribelotta/c098855a510ac39a6a842f5f12aa6091 to your computer and use it in GitHub Desktop.
Save martinribelotta/c098855a510ac39a6a842f5f12aa6091 to your computer and use it in GitHub Desktop.
#include <programa.h>
using namespace sapi;
struct {
DigitalIn button;
DigitalOut led;
} io[] = {
{ { TEC2 }, { LED1 } },
{ { TEC3 }, { LED2 } },
{ { TEC4 }, { LED3 } },
{ { TEC1 }, { LEDR } },
};
int main( void )
{
DigitalOut blinkLed(LEDB);
while( true ) {
for( auto& e: io ) e.led = !e.button;
blinkLed = !blinkLed;
delay( 100 );
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment