Angular2 -- Express -- NodeJS to interact with Raspberry Sensor Hat (not necessarily) and display sensors' data.
-
In the main folder type
cd client && npm install && tsc && cd .. && npm install
-
run
python sensor.py
on the (raspberry) device in order to put data measurements in a file called "data.txt" -
run
node raspiServer.js
in your (raspberry) device (default port is 3001. IMPORTANT NOTE: it gets data from "data.txt") -
adjust device's IP address in server.js to enable a connection between server and devices
-
run
node server.js
on the main machine and test it in localhost:3000
Note: You find a .mdj file in the main folder --> open it with StarUML if you want to visualize a couple of diagrams showing the simple architecture of the project.
Simply modify the function on raspiServer.js (GET sensorData) to return whatever data you want, assuming you respect the JSON schema stated in the mdj file (otherwise the Server and the Angular2 App won't understand it)
- (I'm lazy) provide an image of the JSON data exchange schema for this application
- (Really lazy) Add locking on the "data.txt" file
- Provide extensibility
- Add error handling
- Improve front-end graphics