New
#1681
Dodged a bullet tonight. I misswired my LED shim, really surprised I didn't blow it up. Every time I ran my new code I got an IO error when I tried to light up the LED shim. Checked and double checked my wiring. Didn't see it? I had my +5V and ground plug on the i2c pins and the i2c plug on the +5v and ground pins on the LED Shim. I was feeding +5V into one of the i2c pins SDA I think? My Pico Hat hacker is soldered on wrong way around I think. Anyway, with the correct wires going to the correct pins it worked. Only thing that saved it I think is with it misswired, nothing was grounded. The ground wire wasn't connected to ground. Blind luck.
Anyway here is the code I used.
I think its time to getCode:if sensor.get_sensor_data(): p = sensor.data.pressure p = round(p) if p > 0 and p < 982: # Very Low pc = [255, w, w] # Red msg = "- Barometer is Very Low @ %smb - Storm Watch" % (p) sense.show_message(msg, scroll_speed=s, text_colour=pc) ledshim.set_all(255, 0, 0) # Red M = ((982 - P) / 3) * 4 M = round(M) M = M - 1 # R R R R R R R R R R R R R R R R R R R R R R R R R R R R elif p >= 982 and p < 1004: # Low pc = [255, 255, w] # Yellow msg = "- Barometer is Low @ %smb - Possible Percipitation" % (p) sense.show_message(msg, scroll_speed=s, text_colour=pc) ledshim.set_all(255, 255, 0) # Yellow M = ((1003 - p) / 3) * 4 M = round(M) M = M - 1 # Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y elif p >= 1004 and p < 1026: # Mid Range pc = [w, 255, w] # Green msg = "- Barometer is Mid Range @ %smb" % (p) sense.show_message(msg, scroll_speed=s, text_colour=pc) ledshim.set_all(0, 255, 0) #Green M = ((1026 - p) / 3) * 4 M = round(M) M = M - 1 # G G G G G G G G G G G G G G G G G G G G G G G G G G G G elif p >= 1026 and p < 1048: # High pc = [w, w, 255] # Blue msg = "- Barometer is High @ %smb" % (p) sense.show_message(msg, scroll_speed=s, text_colour=pc) ledshim.set_all(0, 0, 255) #Blue M = ((1048 - p) / 3) * 4 M = round(M) M = M - 1 # B B B B B B B B B B B B B B B B B B B B B B B B B B B B elif p >= 1048: # Very High pc = [255, o, w] # Orange msg = "- Barometer is Very High @ %smb - Expect Dry Conditions" % (p) sense.show_message(msg, scroll_speed=s, text_colour=pc) ledshim.set_all(255, 140, 0) # Orange M = ((1069 - p) / 3) * 4 M = round(M) M = M -1 # O O O O O O O O O O O O O O O O O O O O O O O O O O O O if M < 0: M = 0 ledshim.set_pixel(M, 0, 0, 0) ledshim.show()