BrainDuino

From Esolang
Jump to navigation Jump to search

BrainDuino is BrainFuck-based language running on Arduino Atmel's ATMega based I/O Board. BrainDuino provides memory tape and stack overflow protection. BrainDuino is using serial line I/O for '.' and ',' commands.

There are few more instructions extending BF to BrainDuino:

  • '?' - Read analog input pin's voltage value (0-255) belowing to reference voltage
  • '!' - Set analog output pin's voltage value (0-255) using Pulse width modulation
  • '_' - BusyWait for 10 miliseconds

With this instructions you can make LED fading (like in example code) or change it's intensity depending on some analog sensor (for example fotoresistor, etc...). And you can do much more with serial comunication, you can process input from sensor and pass it to the PC or work with it standalone without PC.

Code examples

  • Turning on LED and fading it out in infinite loop:

[+[-!__]+++++++++++++++++++++++++++++++++++++++]

  • Infinite loop of hello worlds appearing on serial line with LED fading (as above) during it:

[[-]++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.[-]<[-]<[-]<[-!_]<+]

  • Serial (RS232) interface loopback:

[,.+]

  • Pass data from sensor to attached LED/etc...:

[?!+]


External resources