""" Author: Tobias Müller Date: 30.06.2023 Version: 1.0 Main File to run on the pico. """ ############################## Modules ############################## from libs.foo import foo import time from machine import Pin, UART, ADC import machine ############################## Global Variables ############################## baz = foo(Pin(1), Pin(20), led_Pin_timer=Pin(5)) ############################## Main ############################## def main(): # Pin Definitions (Assuming these are correct) output_pin = machine.Pin(26, machine.Pin.IN) lo_minus_pin = machine.Pin(27, machine.Pin.IN) lo_plus_pin = machine.Pin(8, machine.Pin.IN) # Configure ADC adc = ADC(output_pin) print("version_1") # Function to map ADC value to desired range def map_value(value, in_min, in_max, out_min, out_max): return (value - in_min) * (out_max - out_min) / (in_max - in_min) + out_min # Function to read and process ECG signal def read_ecg(): adc_value = adc.read_u16() signal = map_value(adc_value, 0, 65535, 0, 100) # Example mapping return signal # Configure UART for 11520 baud rate # uart = UART(0, baudrate=11520, tx=Pin(0), rx=Pin(1)) # Adjust pins as needed k=0 while True: printlist=[] for i in range(100): ecg_signal = read_ecg() printlist.append(ecg_signal) # Transmit the ECG signal #uart.write(str(ecg_signal) + "\n") # Send data with newline character for ecg_signal in printlist: #k=k+1 #print(k) print(ecg_signal) # Optional delay between readings #time.sleep(0.00001) # Adjust delay as needed """ Main program ########################## Local Variables ############################ led = Pin("LED", Pin.OUT) ########################## Code ############################ # test example class # test example function print(baz.button) # LED blinking while True: led.toggle() sleep_ms(500) led.toggle() sleep_ms(500) """ ############################## Functions ############################## ############################## Run ############################## if __name__ == "__main__": main()