Now open CoolTerm, and you should see something like this:īig deal, right? Same thing as on the Arduino Serial Monitor pretty much, right? Well as far as the viewer goes, you’re pretty much right. Notice we’re printing two values separated by a comma. Serial.println(sensorValue) // print to serial Serial.print(millis()) // print the time in milliseconds since the program started One of the easiest ways to do this is through CoolTerm.Ĭheck out step 3 of the Serial Out lab. Suppose you want to save that data to visualize, use as an outline for a laser cut data guru trophy, compare sensors, etc. Sweet! Now you can “see” the numbers coming through the serial port in two different ways. Saving Data with CoolTerm and Graphing with Excel (or OpenOffice/Google Docs equivalent) If everything goes well, you should get a quickly scrolling graph that looks something like this: increment the horizontal position for the next reading: clear the screen by resetting the background: at the edge of the screen, go back to the beginning: ![]() Line(xPos, height, xPos, yPos) // (x1,y1,x2,y2) Origin located at top left corner MyPort = new Serial(this, portName, 9600) Size(800, 600) // (Width, Height) window size ![]() Serial.write(sensorValue) // print bytes to serialįloat xPos = 0 // horizontal position of the graphįloat yPos = 0 // vertical position of the graph SensorValue = analogRead(sensorPin)/4 // read the value from the sensor The next step is to use another program called Processing to visualize this data.Ĭheck out step 4 of the Serial Out Lab. But unless you have Matrix-like visual skillz, these streaming numbers might be hard to keep track of. ![]() Okay so now you have data streaming in from your Arduino through your USB cable, and can see the values on the Serial Monitor. With a potentiometer (or other sensor) hooked up to analog pin 0, you should be able to click the magnifying glass icon on the top right of the Arduino screen and see something like this: Serial.println(sensorValue) // print value to Serial Monitorĭelay(50) // short delay so we can actually see the numbers SensorValue = analogRead(sensorPin) // read the value from the sensor Serial.begin(9600) // initialize serial communications Int sensorValue = 0 // variable to store the value coming from the sensor Int sensorPin = A0 // analog input pin to hook the sensor to ![]() Sure you can watch analogRead() values scroll at warp speed on your Arduino Serial Monitor, but what if you want to save that data? Or look at a graph you make in real time instead of numbers? Maybe you want to do some self tracking and visualize your Fitbit stats, or compare two different light sensors or force sensing resistors? In this class I’ll demonstrate two workflows that help us do this…Ĭheck out the Analog In lab. This module creates a virtual COM port using USB on your computer which can support various standard Baud Rates for serial communication.Sometimes when you’re prototyping a project it’s nice to see what’s going on with your sensors or variables in your code. This module can be used with Laptop's which don't have standard serial port. The working principle of USB to TTL converter is very simple.This is an USB to TTL UART Converter module which is based on CP2102 Bridge by SiLabs. As in this discovery board we can not get serial data directly from st-link debugger cable so we have to buy one usb to TTL converter. Based on the STM32L100RCT6, it includes an ST-LINK/V2 embedded debug tool, LEDs, pushbuttons for easy connection of additional components and modules.Ģ. It includes everything required for beginners and experienced users to get started quickly. There are mainly two hardwares we have used in this tutorial:ġ.32L100CDISCOVERY: The 32L100CDISCOVERY helps you to discover the features of the STM32L100 Value Line 32-bit Cortex®-M3 microcontrollers and to develop your applications easily.
0 Comments
Leave a Reply. |