Skip to content

Analog Spy

Wim Jongman edited this page Feb 9, 2020 · 5 revisions

Communicate the value of the analog port through binary LED flashing

There are some ways to do serial communication with the ATtiny but all of them involve a shitload of work.

A more lightweight way of communication a value can be achieved with this sketch. It flashes a value between 0 and 1023 to you through attached LEDs. Port 0 communicates the high bits and port 1 communicates the low bits. All you need to do is to scribble along to get the value on the analog port.

Sketch

Start Sequence

The start sequence flashes both LEDs three times. This is an indication that the next sequence is a binary value.

Sketch startup

  • Play the start sequence
  • Test 5 low bits (LED 2 flashes 5 times)
  • Play the start sequence
  • Test 5 high bits (LED 1 flashes 5 times)

Loop

  • Play the start sequence
  • Signal the analog value from analog port 3

Pinout

  • The analog measuring device (a potentiometer) between +5v and AP3
  • A 10K+ pulldown resistor between AP3 and GND.
  • Green LED between DP0 and GND through a current limiting resistor.
  • Red LED between DP1 and GND through a current limiting resistor.

Clone this wiki locally