Esempio n. 1
0
def print_temp():
    global update_interval
    global update_temp_time

    # We only run the contents of this function every 5 seconds
    if update_temp_time < time.time():
        update_temp_time = time.time() + update_interval

        # Grab the temperates and print them
        print("\nInternal PICO-D4 Temp: {:.2f}°C".format(
            TinyPICO.get_internal_temp_C()))
        print("Battery Voltage is {}V".format(TinyPICO.get_battery_voltage()))
        print("Battery Charge State is {}\n".format(
            TinyPICO.get_battery_charging()))
Esempio n. 2
0
spi = SoftSPI(sck=Pin(TinyPICO.DOTSTAR_CLK),
              mosi=Pin(TinyPICO.DOTSTAR_DATA),
              miso=Pin(TinyPICO.SPI_MISO))

# Create a DotStar instance
dotstar = DotStar(spi, 1, brightness=0.5)  # Just one DotStar, half brightness

# Turn on the power to the DotStar
TinyPICO.set_dotstar_power(True)

# Say hello
print("\nHello from TinyPICO!")
print("--------------------\n")

# Show some info on boot
print("Battery Voltage is {}V".format(TinyPICO.get_battery_voltage()))
print("Battery Charge State is {}\n".format(TinyPICO.get_battery_charging()))

# Show available memory
print("Memory Info - micropython.mem_info()")
print("------------------------------------")
micropython.mem_info()

# Create a colour wheel index int
color_index = 0


# Get the amount of RAM and if it's correct, flash green 3 times before rainbow, otherwise flash red three times
def check_ram():
    gc.collect()
    ram = gc.mem_free()
Esempio n. 3
0
 def beacon(self):
     self.blynk_virtual_write(
         BEACON_VPIN,
         TinyPICO.get_battery_voltage())
Esempio n. 4
0
def battery():
    from tinypico import get_battery_voltage, get_battery_charging
    return {'volt': get_battery_voltage(), 'state': get_battery_charging()}
Esempio n. 5
0
def usb_connected():
    return (TinyPICO.get_battery_voltage() == 3.7)