Write Arduino-style sketches with cc65 for VIC-20, PET, and Commodore 64.
This example summarizes the Arduino-style API implemented so far:
void setup(void)
{
pinMode(LED_BUILTIN, OUTPUT);
pinMode(PIN_L, OUTPUT);
}
void loop(void)
{
digitalWrite(LED_BUILTIN, HIGH);
tone(PIN_L, 440);
analogWrite(PIN_M, 85);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
noTone(PIN_L);
analogWrite(PIN_M, 170);
delay(1000);
}
| PIN_1 | PIN_2 | PIN_3 | PIN_4 | PIN_5 | PIN_6 | PIN_7 | PIN_8 | PIN_9 | PIN_10 | PIN_11 | PIN_12 |
|---|---|---|---|---|---|---|---|---|---|---|---|
| GND | (1) | (1) | (1) | (1) | (1) | (1) | (1) | (1) | (1) | (1) | GND |
| GND | (2) | I/O 0 | I/O 1 | I/O 2 | I/O 3 | I/O 4 | I/O 5 | I/O 6 | I/O 7 | (2) | GND |
| PIN_A | PIN_B | PIN_C | PIN_D | PIN_E | PIN_F | PIN_H | PIN_J | PIN_K | PIN_L | PIN_M | PIN_N |
(1) Pins of the upper row differ significantly between systems. Some of them can be used as additional input or output lines.
(2) Pins B and M of the lower row are available on all systems, but with different constraints.
I/O pins from C to L are connected to one port of a VIA or CIA chip on all systems and can be independently programmed as input or output.
This project is inspired by the Arduino programming model and API.
The setup() / loop() structure and function naming follow the conventions popularized by the Arduino platform.
Arduino is an open-source project developed by the Arduino team: https://www.arduino.cc/
This project is not affiliated with or endorsed by Arduino.
