Skip to content

Commit

Permalink
Adding debugging points
Browse files Browse the repository at this point in the history
  • Loading branch information
RaiBnod committed Nov 27, 2024
1 parent 4422308 commit 84eb5e4
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@
app = Flask(__name__)

# config uart pins
print("Configuring UART Pins")
config_uart_pin()
print("UART Pins configured successfully")

# BBB GPIO Lib
import Adafruit_BBIO.GPIO as GPIO
import Adafruit_BBIO.PWM as PWM
import Adafruit_BBIO.ADC as ADC

print("Setting up PINS")
# DOs
GPIO.setup("P8_7", GPIO.OUT)
GPIO.setup("P8_8", GPIO.OUT)
Expand Down Expand Up @@ -49,9 +52,11 @@
# AIs
ADC.setup()

print("PINS setup is successfully completed")

# API stuff
api_ver = '1.1' # change version number as needed
api_port = 5000 # API PORT NUMBER
api_port = 5000 # API PORT NUMBER
uo = 'uo'
ui = 'ui'
do = 'do'
Expand All @@ -67,6 +72,12 @@ def not_found(error):
return make_response(jsonify({'error': 'try again :('}), http_error)


@app.errorhandler(Exception)
def handle_exception(e):
logging.exception("Unhandled exception occurred")
return jsonify({'error': str(e)}), 500


# index page
@app.route('/', methods=['GET'])
def index_page(io_num=None, val=None):
Expand Down Expand Up @@ -178,7 +189,7 @@ def read_ai_all():


if __name__ == '__main__':
app.run(host='0.0.0.0', port = api_port, debug=True)
app.run(host='0.0.0.0', port=api_port, debug=True)

#
# # READ ALL DOs
Expand Down

0 comments on commit 84eb5e4

Please sign in to comment.