#include <nodepp.h>
using namespace nodepp;
void onMain() {
for( uchar x=12; x-->5; ){
pinMode( x, OUTPUT );
}
process::add( coroutine::add( COROUTINE(){
static bool x = false;
coBegin
while( true ){
digitalWrite( 6,!x );
digitalWrite( 5, x );
coDelay(500); x=!x; }
coFinish
}));
process::add( coroutine::add( COROUTINE(){
static uchar x = 0;
coBegin
while( true ){
digitalWrite( 9, x & 0b001 );
digitalWrite( 8, x & 0b010 );
digitalWrite( 7, x & 0b100 );
coDelay(1000); x = ( x+1 ) % 8; }
coFinish
}));
process::add( coroutine::add( COROUTINE(){
static uchar x = 0, y = 0;
coBegin
while( true ){
y = /*----------*/ 0x0A; while( y -->0 ){
x = y%2==0 ? 0xE0: 0x38; while( x != 0 ){
digitalWrite( 10, x & 0b001 );
digitalWrite( 11, x & 0b010 );
digitalWrite( 12, x & 0b100 ); x>>=1;
coDelay(100); }
coDelay(100); }
x = 0x0A; while( x-->0 ){
digitalWrite( 10, x % 2 == 0 );
digitalWrite( 11, x % 2 == 0 );
digitalWrite( 12, x % 2 == 0 );
coDelay(300); }
coNext; }
coFinish
}));
}