Arduino Als ISP (1)
Arduino Als ISP
AtmoLight
Functie Generator
I2C Displays
ISP Bus - Digitale Potmeter
ISP Bus - 12 bit ADC
ISP Bus - 12 bit DAC
Rotary Encoder
YM2413
Arduino_SmartPhone
Bluetooth Tank
Kleurensensor
Robot_lijnvolger
Useless Machine
People_in_Space
EEPROM programmer
lichtkrant
Spectrumanalyzer
Robot Project
Automatische_LED
Spionage_Robot
Balancerende_robot
Relais_op_afstand
Tekstklok
Kerst_Die_Hard
Aftellen2021
woordklok
Dark_Awesom-o
C64_en_Awesomo
Home
Robot besturing met Commodore 64
December 2023:
Hier is de ESP32 sketch die ik gebruikte in deze video:
#include "BluetoothSerial.h" BluetoothSerial SerialBT; String slaveName = "Awesomo32"; // This is the bluetooth name of the slave device String myName = "ESP32-BT-Master"; // ******************************** // ** OUTPUTS ** // ******************************** // see https://www.bartvenneker.nl/index.php?art=0030 // for usable io pins! #define oC64RST GPIO_NUM_21 #define sclk GPIO_NUM_25 #define pload GPIO_NUM_16 // ******************************** // ** INPUTS ** // ******************************** #define resetSwitch GPIO_NUM_15 // this pin outputs PWM signal at boot #define C64IO1 GPIO_NUM_22 #define sdata GPIO_NUM_27 // serial data from the 74hc597 shift register // ******************************** // ** Global Variables ** // ******************************** bool invert_Reset = true; // true voor revisie 2 en hoger!! char ch=0; bool dataFromC64 = false; // ************************************************* // Interrupt routine for IO1 // ************************************************* void IRAM_ATTR isr_io1() { // This signal goes LOW when the commodore writes to (or reads from) the IO1 address space // In our case the Commodore 64 only WRITES the IO1 address space, so ESP32 can read the data. ch = 0; digitalWrite(pload,HIGH); // stop loading parallel data and enable shifting serial data ch=shiftIn(sdata,sclk,MSBFIRST); // shift the data into the ch variable dataFromC64 = true; // set global variable digitalWrite(pload,LOW); // disable the shift register, ready to receive new data } // ************************************************* // Interrupt routine, to restart the esp32 // ************************************************* void IRAM_ATTR isr_reset() { digitalWrite(oC64RST, !invert_Reset); ESP.restart(); } // ************************************************* // SETUP // ************************************************* void setup() { // define inputs pinMode(sdata,INPUT); pinMode(C64IO1, INPUT); pinMode(resetSwitch, INPUT_PULLUP); // define interrupts attachInterrupt(C64IO1, isr_io1, RISING); // interrupt for io1, C64 writes data to io1 address space attachInterrupt(resetSwitch, isr_reset, FALLING); // interrupt for reset button // define outputs pinMode(oC64RST, OUTPUT); digitalWrite(oC64RST, invert_Reset); pinMode(pload,OUTPUT); digitalWrite(pload,LOW); // must be low to load parallel data pinMode(sclk,OUTPUT); digitalWrite(sclk,LOW); // data shifts to serial data output on the transition from low to high. Serial.begin(115200); // for debugging SerialBT.begin(myName, true); // start serial bluetooth //SerialBT.deleteAllBondedDevices(); // Uncomment this to delete paired devices; Must be called after begin // connect to the robot via bluetooth SerialBT.connect(slaveName); // connect to the robots bluetooth Serial.printf("End Setup, into the main loop"); } // end of setup // ****************************************************************************** // MAIN LOOP // ****************************************************************************** void loop() { if (dataFromC64) { SerialBT.write(ch); dataFromC64 = false; } }
Het basic programma
Dit is het basic programma wat ik gebruik in de video