Why needs the
def toggle_green_led(timer) and def toggle_blue_led(timer)
the "timer" in parathesis? Such a variable is nowhere declared.
Hi.
I’m sorry. I should have explained that in the eBook.
The callback functions for the timer event must take one argument. The Timer object is passed automatically as an argument to that function when the event is triggered.
You must have that argument even though you don’t use it.
For more info you can check the documentation: https://docs.micropython.org/en/latest/library/machine.Timer.html#methods
I’ll add that information to the next eBook update.
Thanks.
Regards,
Sara
Hi Sara, thank you for your quick answer.
I fond a bug in the code of “Getting Temperature from Multiple Sensors (with Address)” Page 195/196
After the while true statement, there are the two lines
ds_sensor.convert_temp()
time.sleep_ms(750)
missing. Without them the second sensor says, that in my room it a temperatur of 80 °C, a litte to much.
Sencerely yours, Rudolf from Germany
Hi.
Thanks for pointing that out.
I’ll test the code and fix that.
Regards,
Sara