concept datum in category arduino

This is an excerpt from Manning's book Arduino in Action.
The top part of the serial monitor window is used for sending data to the Arduino. You could, for example, use it to send control commands to the Arduino to turn a servomotor a varying number of degrees, or to open or close a switch. The main part of the window displays data output from the Arduino. This could be used to check the output from a GPS or to perform other signal monitoring.
The serial monitor is very useful for debugging code when linking the Arduino to a computer system running software that interacts in some way with the Arduino; you can use the serial monitor to check that the Arduino is outputting the correct data in the format expected. In the serial monitor, you can also set the baud rate used for communication, autoscroll of text, and the form of line ending that is appended to data sent to the Arduino.
In this listing, a new method is added to the original toggleLED method
, brightness-LED
. You need to distinguish which method is sending data to the Arduino, so you use the Switch’s and the Slider’s Tag properties to store the pin number. Each method sends two bytes to the Arduino, the first identifying the pin and the second the value.
So far we’ve explored how to control the Arduino from an iOS device, but how about reading data from a sensor and using an iOS device to display it? In this section, we’re going to add a GP2D12 IR distance sensor, which you first encountered in chapter 6.
, brightness-LED
. You need to distinguish which method is sending data to the Arduino, so you use the Switch’s and the Slider’s Tag properties to store the pin number. Each method sends two bytes to the Arduino, the first identifying the pin and the second the value.