Created
February 3, 2023 14:05
-
-
Save m0rb/b7b5cec6f4833c96a0009972f64123c1 to your computer and use it in GitHub Desktop.
nodemcu famiclone lpr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
nodemcu line printer for Subor Famiclones | |
- morb | |
*/ | |
const int pins[] = { 16, 5, 4, 0, 2, 14, 12, 13, 15 }; | |
const int busy = 3; | |
byte out; | |
void ICACHE_RAM_ATTR readStrobe() { | |
for (int i=0;i<8;i++) { | |
bitWrite (out, i, (digitalRead(pins[i]))); | |
} | |
Serial.print((char)out); | |
digitalWrite(busy, HIGH); | |
delay(33); | |
digitalWrite(busy, LOW); | |
} | |
void setup() { | |
Serial.begin(115200); | |
pinMode(busy, OUTPUT); | |
for (int i=0;i<9;i++) { | |
pinMode(pins[i], INPUT_PULLUP); | |
} | |
attachInterrupt(15,readStrobe,CHANGE); | |
} | |
void loop() { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment