First MIT app inventor caught my attention the idea of building an app that it will actually appear in my phone. The MIT app inventor users blocks. This application is very similar to scratch it has variables conditions and sensor blocks. I try to use bluetooth so that my phone will communicate through the sensor. But I just needed more time to keep troubleshooting with. But the problem that I was running into was that the bluetooth appear in my phone it was just that it was not able to connect with my phone. Sometimes it ask me what was the password for the bluetooth. Then I looked the datasheet for the code and i put the ones that I read in the datasheet but it did not work.
Then because of time I decided that I wanted to use processing. So I started to watch videos to learn processing. First what is important is that processing is able to read the data that is coming from your board through your port. We used the serial monitor in arduino to display the data that your sensor is giving out to you. But in order for that to happen we need a port because that where everything happens is like a loading dock that's where the board is located. I used a simple code it was just making an LED blink, the goal here was that my Serial would be able to communicate with processing. So after
So I set up my serial in the arduino code which means that we will be able to communicate with the arduino. Then I set my LED pin mode 7. After that I set the serial to read a 2 every time it reads data. High to turn on the LED and Low to turn off the light.I classify the size of the window that is going to pop up. Then I set up my serial list. This is very important because this is where your port are gonna be listed.
If you don't choose the right port this is what is gonna come out. Its gonna give you an error and it will highlight the line.
So I wrote my code for my sonar sensor. Part of this code Im using in my final project. I connected my code to an arduino and it was find it work when I load my code and I started running processing but that was with an arduino.
When I connected to my satshakit I ran into some problems my sensor was not displaying data. This was a problem because I did not include my software serial. Also I did not define my tx and my rx. Then when I uploaded my code and everything started to work and measurements appear.
In my code I declare how big my window is going to be. Also I can change the color of the text, background and you can add shapes you can get crazy and creative with this.In my code I used something called string to display my text. A string is a variable that holds text. So for example I set up string hello = “hi pilar”. This helps me store some text in a string.
Displaying measurements with sonar sensor