Get data from an Arduino to ProtoPie¶
ProtoPie is a powerful tool that can be used for making dynamic prototypes for web, mobile or desktop applications. With ProtoPie you can make complex hi-fi wireframes that use variables, conditions, timeline based animations and moreβ¦
For this article, I will focus on making stuff happen in ProtoPie Studio with an Arduino through ProtoPie Connect. Sending messages to an Arduino is also possible and is covered in a separate article.
Goal¶
In this article I will use an Ultronic sensor to measure the distance to another object. We will send the distance value to ProtoPie Connect to visualize it in ProtoPie Studio.
PS. ProtoPie is free for all students and teachers!
What you will need¶
-
Arduino (I'm using the Arduino UNO R4 Wifi)
-
Four jumper cables to connect the sensor to the Arduino
-
Cable to connect your Arduino to your PC
I've also made a simple example ProtoPie file you can download below.
Instructions¶
Connect your Arduino to your computer and use the Arduino IDE to upload the code below.
After the upload, please make sure the Serial Monitor in Arduino IDE is NOT running. If it is, ProtoPie Connect will not be able to connect to your Arduino in the next steps.
Upload to ProtoPie Connect¶
Open ProtoPie Connect and add the distance.pie file by dragging it in or selecting New > Local Pie.
Choose Plugin¶
Click on Plugin at the top right of the screen
Run Arduino plugin¶
Choose Arduino and select the right port. Leave the baud rate at 9600 and hit Run.
You should now see the message and value coming from the ultrasonic sensor in right section of Connect.
Run Pie file on mobile or browser¶
Choose Connect > QR code to view it on your mobile device or click the Web Browser icon to view it in the browser.
You should see something similar to the GIF below when you in- or decrease the distance to the ultrasonic sensor.
Have fun!