Skip to content

Instantly share code, notes, and snippets.

@m0rb
Created February 3, 2023 14:05
Show Gist options
  • Save m0rb/b7b5cec6f4833c96a0009972f64123c1 to your computer and use it in GitHub Desktop.
Save m0rb/b7b5cec6f4833c96a0009972f64123c1 to your computer and use it in GitHub Desktop.
nodemcu famiclone lpr
/*
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