Basic C language

Basic C language

Keyword:
if…else
A problem representation (expression) must be followed, and if the expression is true, the code after the representation is executed. If this expression is false, it executes the following code . It is allowed to use only if without else.


Example:
if (val == 1) {
digitalWrite(LED,HIGH);
}

for 
Determine the code in a section of the area, and repeat the number of times.
Example:
for (int i = 0; i < 10; i++) {
Serial.print(“ciao”);
}

switch case
“Switch case” is the intersection of more options. According to the value of the variable,. “Swith case” makes the program have more choices. The use of “swith case” makes the program code look simple.
Example:
switch (sensorValue) {
case 23:
digitalWrite(13,HIGH);
break;
case 46:
digitalWrite(12,HIGH);
break;
default: // When all the above conditions do not match, the presupposition action is performed.
digitalWrite(12,LOW);
digitalWrite(13,LOW);
}
while
When the condition is followed by “while”, the code in the parentheses is executed. Example:
// When the sensor value is less than 512, the LED light will flicker.
sensorValue = analogRead(1);
while (sensorValue < 512) {
digitalWrite(13,HIGH);
delay(100);
digitalWrite(13,HIGH);
delay(100);
sensorValue = analogRead(1);
}
do… while
Similar to while, the program code before “while” is executed first, whether it is true or false. So if there is a program code that needs to be executed at least once, you can use “do…” While “architecture.
Example:
do {
digitalWrite(13,HIGH);
delay(100);
digitalWrite(13,HIGH);
delay(100);
sensorValue = analogRead(1);
} while (sensorValue < 512);
break
Let the program code jump off the loop and continue to execute the program code after the loop. In addition, the “break” is also used to separate the “switch case” for different descriptions.
Example:
// When the sensor value is less than 512, the LED light will flicker
do {
// Press the button to leave the cycle
if (digitalRead(7) == HIGH)
break;
digitalWrite(13,HIGH);
delay(100);
digitalWrite(13,HIGH);
delay(100);
sensorValue = analogRead(1);
} while (sensorValue < 512);
continue
In a loop, it can force off the next program and execute the next cycle directly.
Example:
for (light = 0; light < 255; light++)
{
// Neglecting the values between 140 and 200
if ((x > 140) && (x < 200))
continue;
analogWrite(PWMpin, light);
delay(10);
}
return
The end of the function can be returned to a value through “return”.
For example, a function that calculates the current temperature is called “computeTemperature ()”. If you want to return the temperature to the temperature variable, you can write as follows.
int temperature = computeTemperature();
int computeTemperature() {
int temperature = 0;
temperature = (analogRead(0) + 45) / 100;
return temperature;
}
goto
Grammatical symbols:
; (semicolon)
Each line in the Arduino language ends with a semicolon. This syntax allows you to arrange the code freely, and you can put the two instructions on the same line, as long as the middle is separated by a semicolon. (but this may reduce the readability of the program.)

Example:
delay(100);
{} (parentheses)

Parentheses are used to divide code into one block after another. As follows, before and after the “loop ()” function, it must be enclosed in braces.

Example:
void loop(){
Serial.pritln(“cial”);
}

The annotation of the program is the explanation and explanation of the code. Writing annotations helps the programmer (or others) understand the function of the code.
Arduino  The processor ignores the part of the annotation when compiling the code.

Arduino  There are two ways to write annotations in a language
//Single line notes: the whole line of text will be ignored by the processor
/*Multiline annotations:
In this range you can
Wrote a whole poem or article

Operator:

=

+    addition

–    subtraction

*    multiplying

/    Division

%    remainder Division

= =  equal

=!   not equal to

<    less than

>    greater than

<=   Less than equal to or equal to

>=   Greater than equal to or equal to

&&   intersection

||   combine

!    RP

++   accumulation

   Decline

+=
-=
*=
/=
Data types:
boolean
The values of a boolean variable can only be true (true) or false (false).
char
A single character, such as A, is the same as the usual computer practice that stores a character into a number, even if you see a word clearly.
When a character is represented with a number, its value is valid range from -128 to 127.
Note: there are two kinds of mainstream computer coding systems ASCII and UNICODE. The ASCII represents 127 characters for transferring text between a sequence terminal and a time – sharing calculator.
UNICODE can be represented by a lot of characters, which can be used to represent multi – country languages in modern computer operating systems.
byte
The storage values range from 0 to 255. As a character, the byte type variable needs to be stored in only one byte (8 bit) memory space.
int
Integer data type is used in 2 byte memory space. The integer range can be expressed as — 32768 to 32767; integer variable is the most commonly used data type in Arduino.

unsigned int
A non – number integer uses a 2 byte memory space, which means that it can not store negative values, so a number of integers can be represented as an integer range of 0 to 65535.
long
The memory size used by long integers is two times as large as an integer, so it can represent an integer range from – 2147483648 to 2147483647.
unsigned long
A number of integers that can be represented by a non – long integer is 0 to 4294967295.
float
Floating point numbers are used to express numerical values with decimal points. Each floating point number will use four bytes of RAM, pay attention to the limitation of chip memory space, and use floating-point prudently.
double
It is also called a double precision floating-point number, which can express the maximum value of 1.7976931348623157 x 10308.
string
String is used to express text information, it is composed of multiple ASCII characters. You can send a text message through the serial port, or display it on the LCD. Every character in the string is stored in a group tuple space, and a null character is added at the end of the string to prompt the end of the Ardunio processor string. The following two declaring ways are the same.For example:
char string1[] = “Arduino”;//7 character +1 null character
char string2[8] = “Arduino”; // with the same uplink
array
A string of variables can be obtained directly through the index. If you want to store different degrees of LED brightness, you can declare six variables light01, light02, light03, light04, light05, light06, but you actually have a better choice, for example, declare an integer array variable as follows:
Int light[6] = {0, 20, 50, 75, 100}
The word “array” is not used directly in the variable declaration, but [] and {} declared array.
Control instruction
Data type conversion:
char()
byte()
int()
long()
float()
Constant: in the Arduino language, some reserved words with special purposes are defined beforehand.
HIGH | LOW
The level of the digital IO port is expressed, and the HIGH represents the high level (1), and the LOW represents the low level (0). HIGH and LOW are also used to indicate that you turn on or close a Arduino foot (PIN)
INPUT | OUTPUT
This indicates that the IO port direction, “INPUT” represents the input (high resistance), “OUTPUT” represents the output (AVR can provide 5V voltage 40mA current).
true | false
True is true (1), and false is false (0).
Variable:
Variables are used to specify a location in Arduino memory. Variables can be used to store data. Programmers can go through the script code to limit the number of operations variables.
Because Arduino is a very simple microprocessor, but when you declare a variable, you must first define its data type, so that the microprocessor knows how much space it will prepare to store this variable value.

These are the key words and symbols of the basic C language.

188 Replies to “Basic C language”

  1. Pingback: buy cialis
  2. Pingback: Dead-Inside
  3. Pingback: arrogant
  4. Pingback: cialis 20mg pills
  5. Pingback: ne-smotrite-naverx
  6. Pingback: aabbx.store
  7. Pingback: viagra pills
  8. Pingback: sildenafil prices
  9. Pingback: viagra cialis
  10. Pingback: cialis or viagra
  11. Pingback: generic for viagra
  12. Pingback: viagra on line
  13. Pingback: viagra in india
  14. Pingback: viagra sildenafil
  15. Pingback: viagra wirkung
  16. Pingback: viagra generic
  17. Pingback: cheap viagra
  18. Pingback: chewable viagra
  19. Pingback: viagra kaufen
  20. Pingback: cleantalkorg2.ru
  21. Pingback: generic viagra
  22. Pingback: viagra for women
  23. Pingback: viagra buy on line
  24. Pingback: viagra price
  25. Pingback: cialis levitra
  26. Pingback: ivermectin cream
  27. Pingback: viagra connect
  28. Pingback: canadian cialis
  29. Pingback: viagra capsules
  30. Pingback: buy cialis pills
  31. Pingback: viagra cheap
  32. Pingback: 1
  33. Pingback: online viagra
  34. Pingback: Duna 2021
  35. Pingback: cialis sale uk
  36. Pingback: low cost cialis
  37. Pingback: eli lilly cialis
  38. Pingback: cialis 2.5 mg
  39. Pingback: buy viagra online
  40. Pingback: viagra online
  41. Pingback: viagra prices
  42. Pingback: sildenafil coupon
  43. Pingback: prozac for cats
  44. Pingback: how to use viagra
  45. Pingback: psiholog
  46. Pingback: Suicide Squad 2
  47. Pingback: yesmail.ru
  48. Pingback: psychophysics.ru
  49. Pingback: kremlin-team.ru
  50. Pingback: medunitsa.ru
  51. Pingback: KremlinTeam
  52. Pingback: link
  53. Pingback: A3ixW7AS
  54. Here at Leslie’s Pugsland Breeder, Our beautiful fawn pug has given birth to 4 healthy Pug puppies.
    She is our beloved family dog and this is her 1st litter.
    Both mum and dad are AKC registered with 5 gen pedigree certificate. Both from Top Champion bloodlines.Mum and Dad can be seen. Puppies have been wormed weeks 2,4,6,8 and will have had a flea preventative treatment before leaving us.
    They will have their vet check, 1st vaccinations and microchip.
    To view all available puppies and recent pictures, Search us in google as LESLIE’S PUGSLAND BREEDER or click on our website link bellow : https://pugslandbreeder.company.com/
    Pug Puppies for sale | pug for sale near me | pug puppy for sale | pug puppy | pug for sale | pug puppies for sale in va | black pug puppies for sale

  55. Pingback: ukraine
  56. Pingback: vechernyy urgant
  57. Pingback: Porno
  58. Pingback: 66181
  59. Pingback: chernaya vodova
  60. Pingback: blogery_i_dorogi
  61. Pingback: bender na4alo 2021
  62. Pingback: podolsk-region.ru
  63. Pingback: chelovek-iz-90-h
  64. Pingback: top
  65. Pingback: site
  66. Pingback: Ukrainskie-serialy
  67. Pingback: video
  68. Pingback: topvideos
  69. Pingback: kinoteatrzarya.ru
  70. Pingback: projectio-freid
  71. Pingback: psy2022
  72. Pingback: psy
  73. Pingback: news news news
  74. Pingback: 4569987
  75. Pingback: Zakhar Berkut hd
  76. Pingback: cialis 5mg tablets
  77. Pingback: viagra
  78. Pingback: discount pharmacy
  79. Pingback: Avodart
  80. Pingback: pharmacy online
  81. Pingback: viagra vs cialis
  82. Pingback: generic cialis
  83. Pingback: cialis price
  84. Pingback: free-putlockers
  85. Pingback: child porn
  86. Pingback: gay porn
  87. Pingback: 12bet casino
  88. Pingback: fun88
  89. Pingback: live sex cams
  90. Pingback: 바카라사이트
  91. Pingback: SEO操作
  92. Pingback: GLOCK 43
  93. Pingback: THC cartridges
  94. Pingback: Layla
  95. Pingback: paxil here
  96. Pingback: live sex cams

Leave a Reply