Pi GPIO live data (hall efect sensor) to PyGal
- Dominant language
- Python
- Stars
- 2.8k
- Forks
- 419
- PR merge metrics
- No merged PRs in 30d
Description
Hi, im clueless how to add this code that i get from others to be implement in PyGal
i dont need yet to store the data.. just need a realtime graphing in milliseconds..
`@app.route('/thing')
def thing():
def read_thing_state():
while True:
thing_state = { 'rpm' : get_rpm(),
'speed' : get_speed(),
'distance' : get_distance(),
'elapse' : get_elapse(),
'multiplier' : get_multiplier() }
yield 'data:{0}\n\n'.format(json.dumps(thing_state))
return Response(read_thing_state(), mimetype='text/event-stream')`
with PyGal SolidGauge
`@app.route('/pygalexample/')
def pygalexample():
try:
gauge = pygal.SolidGauge(
half_pie=True, inner_radius=0.80,
style=pygal.style.styles['default'](value_font_size=50))
percent_formatter = lambda x: '{:.10g}%'.format(x)
dollar_formatter = lambda x: '{:.10g}$'.format(x)
gauge.value_formatter = percent_formatter
gauge.add('Series 5', [{'value': 225000, 'max_value': 1275000}],
formatter=dollar_formatter)
gauge_data = gauge.render_data_uri()
return render_template("graphing.html", gauge_data = gauge_data)
except Exception, e:
return(str(e))`
best regards
Contributor guide
Research direction
No repository file or test is named. Start by locating the Flask routes and the existing PyGal SolidGauge example, then determine how the Raspberry Pi hall-effect readings should reach the graph; done means realtime updates are visible without storing the data.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- flask, python, raspberry-pi
- Domain
- data-visualization, embedded-iot, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100