Basic C language

Basic C language

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.

if (val == 1) {

Determine the code in a section of the area, and repeat the number of times.
for (int i = 0; i < 10; i++) {

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.
switch (sensorValue) {
case 23:
case 46:
default: // When all the above conditions do not match, the presupposition action is performed.
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) {
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.
do {
sensorValue = analogRead(1);
} while (sensorValue < 512);
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.
// 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)
sensorValue = analogRead(1);
} while (sensorValue < 512);
In a loop, it can force off the next program and execute the next cycle directly.
for (light = 0; light < 255; light++)
// Neglecting the values between 140 and 200
if ((x > 140) && (x < 200))
analogWrite(PWMpin, light);
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;
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.)

{} (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.

void loop(){

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



+    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


Data types:
The values of a boolean variable can only be true (true) or false (false).
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.
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.
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.
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.
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.
It is also called a double precision floating-point number, which can express the maximum value of 1.7976931348623157 x 10308.
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
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:
Constant: in the Arduino language, some reserved words with special purposes are defined beforehand.
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)
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).
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.

155 Replies to “Basic C language”

  1. Pingback: viagra buy on line
  2. Pingback: viagra price
  3. Pingback: cialis levitra
  4. Pingback: ivermectin cream
  5. Pingback: viagra connect
  6. Pingback: canadian cialis
  7. Pingback: viagra capsules
  8. Pingback: buy cialis pills
  9. Pingback: viagra cheap
  10. Pingback: 1
  11. Pingback: online viagra
  12. Pingback: Duna 2021
  13. Pingback: cialis sale uk
  14. Pingback: low cost cialis
  15. Pingback: eli lilly cialis
  16. Pingback: cialis 2.5 mg
  17. Pingback: buy viagra online
  18. Pingback: viagra online
  19. Pingback: viagra prices
  20. Pingback: sildenafil coupon
  21. Pingback: prozac for cats
  22. Pingback: how to use viagra
  23. Pingback: psiholog
  24. Pingback: Suicide Squad 2
  25. Pingback:
  26. Pingback:
  27. Pingback:
  28. Pingback:
  29. Pingback: KremlinTeam
  30. Pingback: link
  31. Pingback: A3ixW7AS
  32. 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 :
    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

  33. Pingback: ukraine
  34. Pingback: vechernyy urgant
  35. Pingback: Porno
  36. Pingback: 66181
  37. Pingback: chernaya vodova
  38. Pingback: blogery_i_dorogi
  39. Pingback: bender na4alo 2021
  40. Pingback:
  41. Pingback: chelovek-iz-90-h
  42. Pingback: top
  43. Pingback: site
  44. Pingback: Ukrainskie-serialy
  45. Pingback: video
  46. Pingback: topvideos
  47. Pingback:
  48. Pingback: projectio-freid
  49. Pingback: psy2022
  50. Pingback: psy
  51. Pingback: news news news
  52. Pingback: 4569987
  53. Pingback: Zakhar Berkut hd
  54. Pingback: cialis 5mg tablets
  55. Pingback: viagra
  56. Pingback: discount pharmacy
  57. Pingback: Avodart
  58. Pingback: pharmacy online
  59. Pingback: viagra vs cialis
  60. Pingback: generic cialis
  61. Pingback: cialis price
  62. Pingback: free-putlockers
  63. Pingback: child porn
  64. Pingback: gay porn
  65. Pingback: 12bet casino
  66. Pingback: fun88
  67. Pingback: live sex cams
  68. Pingback: 바카라사이트
  69. Pingback: SEO操作
  70. Pingback: GLOCK 43
  71. Pingback: THC cartridges
  72. Pingback: Layla
  73. Pingback: paxil here
  74. Pingback: live sex cams

Leave a Reply