Coder Social home page Coder Social logo

raspberry_pi's People

Contributors

biomurph avatar ucpr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

raspberry_pi's Issues

Ras Pi Pico Micropython

I and @akelley want to use this library for the Pico and are developing in Micropython. We have been able to get the sensor to return analog values but are having trouble choosing a good threshold value for a heartbeat. When scaling the threshold value (accounting for the 10bit to 12bit ADC difference) from one of your example programs we wind up with BPM that is significantly higher than expected. Any advice on threshold values or help translating some of the functions in this library would help a lot. Our micropython script is below.

import machine
import utime
from machine import Pin, Timer


sensor_BPM = machine.ADC(28)
conversion_factor = 3.3/65535
thresh = 37200
pin = Pin("LED",Pin.OUT)
holdstate = False
beats = 0
timer=Timer(-1) #virtual timer, the ID will be -1

def interuptHandle(timer):
    #global holdstate
    #holdstate = True
    global beats
    print('flag toggle')
    print('interupting, BPM is: ', (beats*10))
    utime.sleep(1)
    beats = 0

timer.init(period=6000, mode=Timer.PERIODIC, callback=interuptHandle)  

while True:
    if holdstate != True:
        reading = sensor_BPM.read_u16()
        if reading > thresh:
            pin.high()
            beats += 1
            utime.sleep_ms(100)
        else:
            pin.low()
        print("Voltage: ", reading)
    utime.sleep_ms(100)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.