====== 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
----
C6_HEADER(`/* This will be in control6.h */')
int16_t Temperatur;
CONTROL_START
CLOCK_USED()
THREAD(read_temp)
Temperatur = ONEWIRE_GET(10a00599010800da);
ON abs(Temperatur)>250 DO
PIN_SET(LED2);
TTY_SELECT(heiz)
TTY_HOME()
TTY_WRITE("Heizung an ")
END
ON abs(Temperatur)<250 DO
PIN_CLEAR(LED2);
TTY_SELECT(heiz)
TTY_HOME()
TTY_WRITE("Heizung aus")
END
WAIT(5);
THREAD_END(read_temp)
THREAD(temploop)
int16_t Temperatur = ONEWIRE_GET(10a00599010800da);
dnl max. L des erzeugten Strings: 5 (123.4 bzw. -12.3)
char temp_str[5];
itoa_fixedpoint(Temperatur, 1, temp_str);
TTY_SELECT(temp)
TTY_HOME()
TTY_WRITE(`"%5sC"', temp_str)
WAIT(5)
THREAD_END(temploop)
THREAD(update_clock)
TTY_SELECT(clock)
TTY_HOME()
TTY_WRITE_TIME()
WAIT(1)
THREAD_END(update_clock)
ON STARTUP DO
TTY_CLEAR()
TTY_CREATE_WINDOW(clock, 0, 8, 0, 0)
THREAD_START(update_clock)
TTY_CREATE_WINDOW(temp, 0, 6, 0, COLS - 6)
THREAD_START(temploop)
TTY_CREATE_WINDOW(heiz, 0, 11, 1, 0)
THREAD_START(read_temp);
END
CONTROL_END