-
Notifications
You must be signed in to change notification settings - Fork 1
/
led_display.py
65 lines (54 loc) · 1.58 KB
/
led_display.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import time
import Adafruit_GPIO.SPI as SPI
import Adafruit_SSD1306
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
import subprocess
import main as m
RST = 0
disp = Adafruit_SSD1306.SSD1306_128_64(rst=RST)
disp.begin()
disp.clear()
disp.display()
width = disp.width
height = disp.height
image1 = Image.new('1', (width, height))
draw = ImageDraw.Draw(image1)
draw.rectangle((0,0,width,height), outline=0, fill=0)
padding = -2
top = padding
bottom = height-padding
x = 0
font = ImageFont.load_default()
import requests
# api-endpoint
URL = "https://surgical-glass.herokuapp.com/api/v1/"
r = requests.get(url = URL)
data = r.json()
#print(data['data'])
doctor = data['data'][0]['doctor']
print('\nThe doctor is: ',doctor)
imp_pts = data['data'][0]['important_points']
meds = data['data'][0]['medications']
log = data['data'][0]['log']
print('\nLOG: ',log)
print('\nmedications for this: ',meds)
print('\nThe important points are: ',imp_pts)
while True:
#[keys,ent] = m.get_text()
#phrases = keys[1]
#print('key phrases: ', phrases)
draw.rectangle((0,0,width,height), outline=0, fill=255)
# Write two lines of text.
disp.clear()
disp.display()
draw.text((x, top), log , font=font, fill=0)
draw.text((x, top+8), meds, font=font, fill=0)
#draw.text((x, top+16), "For more Videos", font=font, fill=255)
#draw.text((x, top+25), "Visit at", font=font, fill=255)
#draw.text((x, top+34), "www.circuitdigest.com", font=font, fill=255)'''
# Display image.
disp.image(image1)
disp.display()
time.sleep(2)