TARS version 1.0

Programming

Credits goes to Arduino IDE

As in most of my assignments, firmware was made in Arduino IDE environment. It provided me with comfort, as I was closely working with Pinmap, which is presented in Electronics part. TARS may be reprogrammed almost in any moment as I left ISP connection into it. Wire may be easily hidden.

The code

Declarations and variables

Variables

Firstly I declated LCD display pins. They could be direcly put inside LiquidCrystal function but I decided not to do so. In different PCB versions I could change them without issues.

Photoresistor, thermistor and two buttons gained integer variables. Those are handy during reading their values.

Later on there are declaration of pins, taken from already mentioned pinmap.

Void setup()

Void setup()

Void loop is mainly used for two purposes. First it defines INPUTS and OUTPUTS. Then it visualizes welcome message for the user.

Side note: I implemented a little Easter Egg in here. TARS is increasing honesty level to 95% and decreasing humour level to 60% as Cooper requested him in the movie.

Void loop() and button operation

Begin of Void loop() and button functions

There are two buttons and those are turning on each high current circuit, either Rainbow Generator or Planet Projector. I ensured that in the same moment only one circuit may be turned on. Naturally, distance of buttons to the arms defines, which feature it turns on

Reading Photoresistor

Photoresistor function

In this part of the code I'm defining operation of Photoresistor. In a moment that read value drops under 500, which is basically level of dark room with minor ambient light (or sensor covered with finger) there is a message sent to the user that "It's dark Coop!" and value of the sensor is visualized. This last for 2 seconds.

Troubleshooting and conclusions

It is important to understand differences between if loops and while loops. For instance I used first kind of loops. By that I made each arm turned on until other button is pressed. In general at this point firmware is weakest point of TARS. There is a huge potential in this place. Unfortunately I didn't have time to explore it and expand it. Surely I will do it after final presentation.

This part of the final project was either partially done or learned during: