two legs of the button are connected so that the PIN is connected to a 5 V level, reading me HIGH (HIGH) or 1.If the number I/o pin is not connected, the LED may flash. This is because the input is uncertain. That is to say, there is no fixed connection to voltage or ground, so HIGH or LOW will be returned randomly, so you need to connect a drop-down resistor.Schematic diagram
CodeIn the following program, the first thing you need to do in the setup function is to enable
Target: BlackBerry mobile phone via Bluetooth serial read Arduino Bluetooth transmission of temperature and humidity information
Hardware: Arduino motherboard + DHT11 temperature and humidity sensor + Bluetooth module, development tools C language
Mobile: BlackBerry 9360 Mobile, OS 7.1, development tools Java
Mobile: B
information is sent to the computer for Arduino,RX(r:receive receive) indicates that the Arduino receives The instruction information from the computer, which flashes when the program is downloaded or when it communicates with the computer.Let me illustrate with an example, and we'll write a simple applet that lets the computer display the string "Hello world".
Arduino Port Code:
int red=255; Create variables to store the data to be sent
int green = 2;
int blue = 3;
void Setup ()
{
serial.begin (9600);//define a data transfer rate of 9600 bits
}
void Loop ()
{
serial.print (red);
Serial.print (",");
Serial.print (green);
Serial.print (",");
Serial.print (blue);
Serial.print ("\ n");
Delay (+);
}
Above red, Green,blue is replaced with the value obtained by the color sensor in the actual app
Serial port operation of the class, including write and read operations, class can set the serial port parameters, set the reception function, open the serial port resources, close the serial port resources, the operation is completed, must close the
(Par_none); Parity setting, we are set to Mycom->setstopbits (Stop_1) without verification; Stop bit setting, we set to 1 bit stop bit mycom->setflowcontrol (Flow_off); Data flow control settings, we are set to no data flow control mycom->settimeout (50); Delay setting, set to delay 20ms} void Readspeed () {Qbytearray temp = Mycom->readall (); Reads all data from the serial buffer to the TEMP//Temporary variable temp//temporary v
in the auxiliary thread. The priority of the auxiliary thread is relatively low. Therefore, this event cannot be triggered when data in each byte arrives.
(6) download the example:Http://files.cnblogs.com/aierong/sms.rarExample Description: This is a short message sent by the GSM Modem, which receives small programs. It is implemented using the SerialPort class.
(7). Bug
When the serial port class of. NET 2.0 adopts Io. Ports. Parity. Even verif
virtual serial port, and data can be transmitted between them. Spsend sends dataSerialPort spreceive; // spreceive receives dataTextbox txtsend; // sending areaTextbox txtreceive; // receiving areaButton btnsend; // data sending buttonDelegate void updatetexteventhandler (string text); // delegate, which is the focusUpdatetexteventhandler updatetext;
Public void initclient () // The form control has been
ManagementParallelport: Parallel Communication PortParallelportevent parallel port eventSerialPort RS-232 serial communication portSerialportevent serial port event
Three exception classesNosuchportexception thrown when the driver cannot find the specified portPortinuseexception thrown when a specified port is in useThe unsupportedcommoperationexception driver cannot throwInstanceAnother examples file down
; finally closehandle (hdevice); end; with pidsector (pchar (poutdata) + 16) ^ do begin changebyteorder (sserialnumber, sizeof (sserialnumber); setstring (result, sserialnumber, sizeof (sserialnumber); end; Result: = trim (result); end; getidediskserialnumber (0) during use; assume that the hard disk is connected to the 0 # IDE.
Top
Reply:Imageonline (no rent)() Credit: 100
2003-004 12: 56: 41z
Score: 0
?
I. What is the
In the last blog, we introduced the thread application in serial communication to solve the problem of receiving data. But in the end, we have 3 questions to ask. Today we'll show you how the first problem is handled, that is, if the data length of the returned data is different, how to write a loop in the Read method to read the full return data.
Of course if yo
Using system;Using system. IO;Using system. runtime. interopservices;Using system. text;Using Microsoft. Win32;
Namespace wjb. readorwriteiniandreg{/**/////// Read the hard disk serial number of the specified drive letter///Public class harddiskval{[Dllimport ("kernel32.dll")]Private Static extern int getvolumeinformation (String lprootpathname,
Getting the serial number is the information to read the soft hard disc, which can be obtained by using the following function:
Public Declare Function getvolumeinformation Lib "kernel32.dll" Alias "Getvolumeinformationa" (ByVal lpRootPathName as St Ring, ByVal Lpvolumenamebuffer as String, ByVal nvolumenamesize as Integer, Lpvolumeserialnumber as Long, Lpmaximu
hard drive serial number stringStrmnum = strnum.substring (0, -);//Remove the first 24 characters from the generated string as machine code returnStrmnum; } Public int[] Intcode =New int[127];//Store Key Public int[] intnumber =New int[ -];//ASCII value of the stored machine code Public Char[] CharCode =New Char[ -];//Storage Machine code word Public vo
This article describes how C # implements the method of reading the serial number of a specified drive letter. Share to everyone for your reference, specific as follows:
Using System;
Using System.IO;
Using System.Runtime.InteropServices;
Using System.Text;
Using Microsoft.Win32; Namespace Wjb.readorwriteiniandreg {/**///////reads the hard drive serial number of the specified letter///public class Har
Hard disk
Using System;Using System.IO;Using System.Runtime.InteropServices;Using System.Text;Using Microsoft.Win32;
Namespace Wjb.readorwriteiniandreg{/**////Read the hard drive sequence number of the specified drive letter///public class Harddiskval{[DllImport ("kernel32.dll")]private static extern int GetVolumeInformation (String lpRootPathName,String Lpvolume
The following is the Android read the user number, mobile phone number, SIM card serial number of the implementation code is introduced, need friends can come to refer to the next
1, using the method provided by Telephonymanager, the core code:
Copy Code code as follows:
Telephonymanager TM = (Telephonymanager) this.getsystemservice (Telephony_service);
String I
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.