cs151051
5 years ago
4 changed files with 45 additions and 2 deletions
@ -0,0 +1,4 @@ |
|||
all: |
|||
sudo chmod +x /dev/ttyACM0 |
|||
python3 parking.py |
|||
|
@ -0,0 +1,25 @@ |
|||
#!/usr/bin/env python |
|||
|
|||
import time |
|||
import serial |
|||
ser = serial.Serial( |
|||
port='/dev/ttyACM0', |
|||
baudrate = 9600, |
|||
parity=serial.PARITY_NONE, |
|||
stopbits=serial.STOPBITS_ONE, |
|||
bytesize=serial.EIGHTBITS, |
|||
timeout=1 |
|||
) |
|||
counter=0 |
|||
|
|||
while 1: |
|||
park_status = ser.readline() |
|||
try: |
|||
if park_status != prev_status: |
|||
if b'1' in park_status: |
|||
print("parking reserved.\n") |
|||
elif b'0' in park_status: |
|||
print("parking not reserved.\n") |
|||
except NameError: |
|||
print("**Not already prev variable.\n") |
|||
prev_status = park_status |
@ -0,0 +1,14 @@ |
|||
#Authors: Oulis Evangelos, Oulis Nikolaos, Drosos Katsibras |
|||
from flask import Flask, request |
|||
from flask_restful import Resource, Api |
|||
from json import dumps |
|||
from flask.ext.jsonpify import jsonify |
|||
|
|||
app = Flask(__name__) |
|||
apy = Api(app) |
|||
|
|||
parking =[] |
|||
|
|||
class Parking(Resource): |
|||
def get(self): |
|||
|
Loading…
Reference in new issue