Arduino example Syntax

Source: Internet
Author: User
void Setup () {} void Loop () {} small light flashing void Setup () {Pinmode (2,output);} void Loop () {Digitalwrite (2,lo
	W);//light delay (1000);
Digitalwrite (2,high);//Control PIN level delay (1000); /////////////////////////////////////////////////////////////////////Serial communication Void Setup () {serial.begin (9600);// Select channeling wave rate} void loop () {Serial.print ("Hello word\n");//display content delay (1000);}///////////////////////////////////////////// #define LED #define KEY 2 void Setup () {Pinmode (led,output);//define IO port as output port Pinmode (KE Y,input)//define 2 IO port for input} void loop () {} anlogread ()//Read value///////////////////////////////////////////////////////////    
PWM dimming breathing lamp analog amount of discrete int ledpin = 9;    int a=0,b=0;     Define numeric void Setup () {} void Loop () {for (A; a<=; a++) {Analogwrite (Ledpin, a);
  PWM Wave Analogwrite (Control of the pin, duty ratio (the higher the number-the greater the Energy)) delay (30);
    	for (int b =; b >= 0; b--) {analogwrite (ledpin,b); DeLay (30); }//////////////////////////////////////////////////////////////////////////rudder yellow signal line red Power brown ground #include <serv O.h>//Includes rudder hangar servo MYSERVO; Create a steering Gear control class int pos = 0; 
Define a variable to store the steering gear rotation angle int A; void Setup () {Myservo.attach (9);///Connecting steering gear to number 9th digit port} void loop () {int value=0; while (1) {value=value+150;//reading analog value PO input from A0 port S=map (value,0,1023,0,180); The analog value 0~1023 is mapped to 0°~180°myservo.write (POS);
The steering gear rotates to the corresponding angle serial.println (value); Delay (500);
  Delay the steering gear to rotate to the corresponding position if (value>=1000) {break; 
}}///////////////////////////////////////////////////////Trolley 1 high 2 low 3 low 4 high forward/////////////////////////
#define Adpin A0 #difinr buzzer 2 int adbuffer=0;
	void Setup () {Pinmode (buzzer,output);
Serial.begin (9600);

} void Loop () {Adbuffer=analogread (Adpin) serial.print (Adpin); }

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.