Пример #1
0
    def read(self):
        import machine

        rawvalue = machine.temperature()

        # Fahrenheit
        # 'system.temperature': 57.77778
        #temperature = (rawvalue - 32) / 1.8

        # Magic
        # 'system.temperature': 41.30435
        value = rawvalue * (44 / 23) + (-5034 / 23)

        reading = {'system.temperature': value}
        return reading
Пример #2
0
def sha_stress(verbose=True):
    global sha_stress_running, sha_stress_verbose
    import machine
    l = 20_000
    sha_stress_running = True
    sha_stress_verbose = verbose
    print('sha_stress start', l)
    while sha_stress_running:
        t_ms = time.ticks_ms()
        d = sha_test(l)
        temp = (machine.temperature() - 32) / 1.8
        t_s = (time.ticks_ms() - t_ms) / 1000
        sha_stress_verbose and print(time.time(), t_s, temp, len(d))
        pybytes.send_signal(1, time.time())
        pybytes.send_signal(2, temp)
        pybytes.send_signal(3, t_s)
    print('sha_stress end')
Пример #3
0
    def read(self):
        """ """
        import machine

        if not hasattr(machine, 'temperature'):
            raise NotImplementedError('Reading the MCU core temperature is '
                                      'not implemented on this platform')

        rawvalue = machine.temperature()

        # Fahrenheit
        # 'system.temperature': 57.77778
        #temperature = (rawvalue - 32) / 1.8

        # Magic
        # 'system.temperature': 41.30435
        value = rawvalue * (44 / 23) + (-5034 / 23)

        reading = {'system.temperature': value}
        return reading
Пример #4
0
def get_self_temperature():
    return int((machine.temperature() - 32) * 100 / 1.8)
Пример #5
0
import time
boot0_t = time.time()
import machine
cpu_temp0_f = machine.temperature()
import pycom
print('boot.py', boot0_t, time.ticks_ms(), 'pybytes_on_boot=',
      pycom.pybytes_on_boot())
pycom.heartbeat(False)
pycom.rgbled(0x030300)  # yellow
Пример #6
0
import machine

def print_wifi_mode(m):
    if m == WLAN.AP:
        print("AP", end='')
    elif m == WLAN.STA:
        print("STA", end='')
    elif m == WLAN.STA_AP:
        print("STA_AP", end='')

print(os.uname().sysname.lower() + '-' + binascii.hexlify(machine.unique_id()).decode("utf-8")[-4:], "get_state.py")

print("===== machine ====================================")
print("unique_id", binascii.hexlify(machine.unique_id()))
try:
    print("temperature", machine.temperature())
except:
    pass
mrc = machine.reset_cause()
print('reset_cause', mrc, end=' ')
if mrc == machine.PWRON_RESET:
    print("PWRON_RESET")
    # plug in
    # press reset button on module
    # reset button on JTAG board
    # core dump
elif mrc == machine.HARD_RESET:
    print("HARD_RESET")
elif mrc == machine.WDT_RESET:
    print("WDT_RESET")
    # machine.reset()