TMP36, mapping and the use of millis() function

hey everyone! this is my second week learning arduino in class but it's difficult for me to understand it. i am supposed to make a sketch for this hw and i did my best on this but i am not smart enough for this:

In this assignment, you will program an Arduino microcontroller to monitor the temperature. A green LED light will indicate the temperature with brighter output for higher temperatures. A second red LED light will warn if the temperature is too high. This red LED will turn on at a temperature of 40°C or higher. It will toggle on/off if the temperature is above 70°C at 1 Hz frequency. Allow the system to read temperatures and update the indicators as fast as possible, so do not “block” (i.e. do not use any delay() functions). This means that your toggling algorithm (when T >= 70°C) needs to look at the “clock” and determine whether to toggle on/off or not. Do this using a variable that holds the future time to next toggle the light, and compare it with the current time using millis() function.

It is recommended to use the TinkerCAD site at www.tinkercad.com to create a virtual Arduino set-up that you can test your program with. Note that the simulator runs slower than actual clock time depending on your computer’s speed; the wall-clock time is indicated near the top of the page. This means your flashing LED will flash slower than 1 Hz in the simulator.

Your program must have or do the following:

Properly wire a green LED to PWM output pin 3, a red LED to output pin 7, and a TMP36 temperature sensor to analog output pin A0

Do not use any delay() or delayMicroseconds() functions to “block” the system

Use map() function to set the green LED full range to the full range on the TMP36 (see TMP36 documentation on Blackboard)

The demo Several Things at a Time illustrates the use of millis() to manage timing without blocking. It may help with understanding the technique.

Have a look at Using millis() for timing. A beginners guide if you need more explanation.

…R