editor.tc¶
TinyC - Hello World
// TinyC - Hello World
// Compile (Ctrl+Enter) then Run (Ctrl+Shift+Enter)
#define LED 8
#define INPUT 0x01
#define OUTPUT 0x03
#define INPUT_PULLUP 0x05
#define INPUT_PULLDOWN 0x09
int square(int x) {
return x * x;
}
int main() {
printStr("Hello TinyC!");
// Calculate some squares
int i = 1;
while (i <= 10) {
int sq = square(i);
print(sq);
i++;
}
// Blink LED 5 times
pinMode(LED, OUTPUT);
int count = 0;
while (count < 5) {
digitalWrite(LED, 1);
delay(250);
digitalWrite(LED, 0);
delay(250);
count++;
}
printStr("Done!");
return 0;
}