Dies ist eine alte Version des Dokuments!
C6-Notizen
http://paste2.org/p/1193223 LED TOGGLE WEN 25 grad
C6_HEADER(`/* This will be in control6.h */')
#include "services/stella/stella.h"
CONTROL_START
THREAD(test)
ON IRMP_READ > 0 DO
if(IRMP_PROTOCOL==8 && IRMP_ADDRESS==0x0002) switch(IRMP_COMMAND)
{
case 0x0268:
stella_setValue(STELLA_SET_IMMEDIATELY, 0, 255);
break;
case 0x0068:
stella_setValue(STELLA_SET_IMMEDIATELY, 0, 0);
break;
}
END
THREAD_END(test)
ON STARTUP DO
THREAD_START(test);
END
CONTROL_END
am einfachsten ist && IRMP_FLAGS==0
C6_HEADER(`/* This will be in control6.h */')
CONTROL_START
PIN_INPUT(KEY)
PIN_PULLUP(KEY)
PIN_OUTPUT(LED)
THREAD(online)
TIMER_START(onew)
PIN_SET(LED);
TIMER_WAIT(onew, 1)
ON PIN_FALLING(KEY) DO THREAD_STOP(online) END
THREAD_END(online)
ON PIN_FALLING(KEY) DO THREAD_RESTART(online) END
CONTROL_END
CONTROL_START
THREAD(templog)
// Define variables
int16_t temp = 0;
char temp_str[5];
// Write timestamp to temp.log
VFS_LOG("temp.log", "\n%04d-%02d-%02d %02d:%02d", CLOCK_YEAR(), CLOCK_MONTH(), CLOCK_DAY(), CLOCK_HOUR(), CLOCK_MIN());
// Get value of 1-Wire sensor
temp = ONEWIRE_GET(100004990108004b);
// Convert value to string
itoa_fixedpoint(temp, 1, temp_str);
// Write value to temp.log
VFS_LOG("temp.log", "|100004990108004b:%5s", temp_str);
WAIT(2);
// Get value of 1-Wire sensor
temp = ONEWIRE_GET(108ae8980108001a);
// Convert value to string
itoa_fixedpoint(temp, 1, temp_str);
// Write value to temp.log
VFS_LOG("temp.log", "|108ae8980108001a:%5s", temp_str);
WAIT(2);
// Get value of 1-Wire sensor
temp = ONEWIRE_GET(1065f79801080004);
// Convert value to string
itoa_fixedpoint(temp, 1, temp_str);
// Write value to temp.log
VFS_LOG("temp.log", "|1065f79801080004:%5s", temp_str);
WAIT(600);
THREAD_END(templog)
ON ONCE CLOCK_MIN == 0 DO THREAD_RESTART(templog); END
ON ONCE CLOCK_MIN == 5 DO THREAD_RESTART(templog); END
ON ONCE CLOCK_MIN == 10 DO THREAD_RESTART(templog); END
ON ONCE CLOCK_MIN == 15 DO THREAD_RESTART(templog); END
ON ONCE CLOCK_MIN == 20 DO THREAD_RESTART(templog); END
ON ONCE CLOCK_MIN == 25 DO THREAD_RESTART(templog); END
ON ONCE CLOCK_MIN == 30 DO THREAD_RESTART(templog); END
ON ONCE CLOCK_MIN == 35 DO THREAD_RESTART(templog); END
ON ONCE CLOCK_MIN == 40 DO THREAD_RESTART(templog); END
ON ONCE CLOCK_MIN == 45 DO THREAD_RESTART(templog); END
ON ONCE CLOCK_MIN == 50 DO THREAD_RESTART(templog); END
ON ONCE CLOCK_MIN == 55 DO THREAD_RESTART(templog); END
CONTROL_END