(Black Line) Path Tracking Sensors (2022 - 2023)
The path sensors are 8 pairs of IR emitter and detector. It provides an 8-bit data which to be translated to the position of the line. There are so many ways to do it. I did it manually by intuition as there are only 256 cases. RES 255 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Put table in flash memory const unsigned char loop_up_table[]= { 0, 1, 2, ... }; Without the keyword const the table will be stored in RAM. But it won't save you flash memory as the initialization data are stored in FLASH. Using const saves RAM and the table is read directly from flash. However, reading flash on AVR is different. In AVR, flash and RAM are on different address buses. It is required to include <pgmspace.h> in order to read program flash.