Home

Arduino switch case bereich

Similar to the if statements, switch...case controls the flow of programs by allowing the programmers to specify different codes that should be executed in various conditions. In particular, a switch statement compares the value of a variable to the values specified in the case statements. When a case statement is found whose value matches that of the variable, the code in that case statement. case 1: case 2: case 3: /*...*/. won't work. It will yield 1. If there is a zero in there it will always be zero. The 1. 5 syntax is a gcc extension. Since you will probably always use gcc for this it should always work, but if avr should switch to clang or something, it might break in the future In echtem C/C++ ist das leider ein Syntaxfehler. Zur Abfrage von Bereichen käme wohl folgendes am nächsten: case 1: case 2: case 3: Bereich1bis3 (); break; case 27: case 28: case 29: case 30: Bereich27bis30 (); break; Ist bei grösseren Bereichen natürlich auch nicht wirklich elegant. Antworten Zitieren. 0 Like if statements, switch case controls the flow of programs by allowing programmers to specify different code that should be executed in various conditions. In particular, a switch statement compares the value of a variable to the values specified in case statements. When a case statement is found whose value matches that of the variable, the code in that case statement is run

Switch Anweisung - Schlüsselwort break switch - case - default. Da wir hier aber nicht alle 4.294.967,295 Werte behandeln wollen, gibt es das Schlüsselwort default. Mit diesem Schlüsselwort können wir bequem alle Werte welche wir in der Switch Anweisung nicht aufgeführt haben behandeln Der switch- Befehl gleicht den Inhalt der Variable ( hier Variable nummer) mit den von dir angegebenen Bedingungen ab. Wenn eine Bedingung zutrifft wird die Anweisung, die mit der Bedingung zusammenhängt, ausgeführt. Die Bedingung oder der jeweilige Fall (case) besteht aus: case WERT : Anweisung1. break Switch case in Arduino is just like the switch case in C language. For those who are unaware of switch case, it is a more compact way of writing multiple if statements, when they concern the value of a variable Arduino Course for Absolute Beginners Switch Case Statements. Here is a secret about human relations a boss from long ago once told me. If you and your spouse decide to go out to dinner do not ask, Where do you want to go? instead, give a list of options, Do you want to go to Mike's Bar and Grill, The Dive, or La Pura Di Mona Switch (case) Statement, used with sensor input . An if statement allows you to choose between two discrete options, TRUE or FALSE. When there are more than two options, you can use multiple if statements, or you can use the switch statement. Switch allows you to choose between several discrete options. This tutorial shows you how to use it to switch between four desired states of a photo.

Hallo, nein das geht nicht. Die Entwickler von .NET wollten die switch-Anweisung an die von C/C++ anlehnen. Ich persönlich finde es etwas schade, da beispielsweise in VB.NET so ziehmlich alles in Select Case gemacht werden kann und es teilweise dort viel einfacher ist solche Sachen umzuetzen int range = 5 int newNumber = number / range; switch (newNumber) { case (0): //number 0 to 4 break; case (1): //number 5 to 9 break; case (2): //number 10 to 14 break; default: break; } Otherwise: if else Share. Follow answered Aug 13 '14 at 11:18. benba benba. 695 7 7 silver badges 15 15 bronze badges. Add a comment | 3 As mentioned if-else would be better in this case, where you will be.

Arduino Switch Case Statements & Keyboard Input. How is it the QWERTY keyboard has been around so long? We used to hunt & gather now we hunt & peck (or at least I do). It seems the keyboard is a long lasting human interface device that will be around for at least until the singularity, so we might as well make the best use of it. This lesson introduces the use of the keyboard to. // The value we'll be evaluating: let code = 100; // Matches for any case where the expression === `true`: switch (true) { case code <= 64: return Your number is 64 or less!; break; case code >= 65 && code <= 90: return Your number is in the range of 65-90!; break; case code >= 97 && code <= 122: return Your number is in the range of 97-122!; break; case code >= 123: return Your number.

Arduino - switch case statemen

  1. An Tag 12 der Arduino-Basics Reihe erkläre ich was Methoden/Funktionen sind und wie man sie verwendet. Zusätzlich zeige ich euch die switch-case Anweisung al..
  2. Description. Like if statements, switch case controls the flow of programs by allowing programmers to specify different code that should be executed in various conditions. In particular, a switch statement compares the value of a variable to the values specified in case statements. When a case statement is found whose value matches that of the variable, the code in that case statement is run
  3. A switch case statement is used in place of multiple if statements. When using a switch case, the program will take a variable, in the example below it is range, and compare it to several cases. It will then select the matching case, and run the code listed under it before returning to the top and looping through the code again. In the.
  4. I'm writing code on Arduino (very similar to C, which I don't know, or very little), and I have a little issue concerning the switch/case statement. I need my Arduino to do this or that depending on the values of a potentiometer (0 to 1023). However, I have no clue how to tell it case 0 to 200. For example, I trie
  5. Mit einer switch-case-Abfrage lassen sich solche Abfragen manchmal eleganter lösen. Mit switch-case ist es möglich, sehr übersichtlich - abhängig vom aktuellen Wert der Variablen- unterschiedliche Anweisungen ausführen. In der heutigen Folge möchte ich die Abfrage mit switch-case vorstellen: Viel Spaß mit dem Video. [ >> Hier geht es zurück zur Übersichtsseite des Mikrocontroller.

Permanent Redirect. C Kurs - too many ifs - I think I switch. Im Kapitel if Abfragen haben wir gelernt, wie wir eine if - else -if -else -if -elseLeiter bauen, dies wird aber recht unpraktisch wenn man 20 , 100, oder sonstwievele Bedingungen abfragen muss. Für diese Fälle bietet C das switch Element, mit dem man solche Fälle viel bequemer programmieren kann.Auf gut deutsch heißt dass multiple branching Arduino switch case range. Riesenauswahl an Markenqualität.Folge Deiner Leidenschaft bei eBay! Kostenloser Versand verfügbar. Kauf auf eBay. eBay-Garantie switch (var) { case 1: //do something when var equals 1 break; case 2: //do something when var equals 2 break; default: // if nothing else matches, do the default // default is optional break; } See als In Visual Basic, when using a switch.

Switch Case with a range? - Arduino Foru

Nun muss nacheinander die Arduino-Software und der USB-Treiber für das Board installiert werden. 2.2.1.1 Installation und Einstellung der Arduino-Software 1. Software von www.arduino.cc downloaden und auf dem PC installieren (Das Arduino-Board noch NICHT angeschlossen). Danach öffnet man den Softwareordner und starte switch arduino case range Code Answer. arduino switch case . cpp by Splendid Scarab on Feb 07 2021 Donate . 1 Source: www.arduino.cc. Add a Grepper Answer . C++ answers related to switch arduino case range. switch-case-Abfrage Will man einen Wert auf verschiedene Zustände prüfen, bietet sich die switch-case-Abfrage an. Die Struktur sieht so aus: switch (meineVariable) { case 1: befehl1; break; case 2: befehl2; break; default: befehl3; break; } Hierbei wird der Block case 1 ausgeführt, wenn meineVariable == 1 ist. Ist sie 2, wird der Block case 2 ausgeführt. Ist sie weder 1 noch 2, wird der. switch (var) { case label1: // statements break; case label2: // statements break; default: // statements break; Switch Case. Möchten wir viele Fälle unterscheiden und für jeden Fall unterschiedliche Aktionen ausführen, so können wir das mit vielen if Anweisungen oder mit einer switch case Anweisung erreichen. In die Klammern nach dem Schlüsselwort switch schreiben wir den Ausdruck, welchen wir auswerten möchten. Danach folgen mit dem Schlüsselwort case die verschiedenen Fälle, nach dem.

Mit switch/case einen Bereich abfragen? (war: Simple Frage

switchcase - Arduino Referenc

  1. ate the case once it is executed and the control will fall out of the switch
  2. In my effort to better understand the Arduino platform, I've come up with a discussion topic...While working on a current project, I came up with Press J to jump to the feed. Press question mark to learn the rest of the keyboard shortcuts. Search within r/arduino. r/arduino. Log In Sign Up. User account menu. 1. Switch-Case vs If/If Else? Software Help. Close. 1. Posted by. nano. 2 years.
  3. I am trying to control an RGB LED strip with an Arduino. Using MOSFETs: https://learn.adafruit.com/rgb-led-strips?view=all Using LED Amplifiers: http://www.
  4. Welcome to Pakluck Online Shopping Store ! Courses. Service
  5. Control Statements are elements in Source Code that control the flow of program execution. They are −. S.NO. Control Statement & Description. 1. If statement. It takes an expression in parenthesis and a statement or block of statements. If the expression is true then the statement or block of statements gets executed otherwise these.

Der switch Anweisungstext besteht aus einer Reihe von case Bezeichnungen und opt einerionalen default Bezeichnung. Eine labeled-statement ist eine dieser Bezeichnungen und die folgenden Anweisungen. Die bezeichneten Anweisungen sind keine syntaktischen Anforderungen, aber die switch Anweisung ist ohne sie bedeutungslos Arduino's great, but how in the world do you do two (or more) things at once on separate intervals? You need protothreading! How to Multithread an Arduino (Protothreading Tutorial) Project tutorial by Drew Alden. 250,332 views; 43 comments; 134 respects; Use HC-SR04 on Arduino with Processing. Arduino Sonar . Project tutorial by Tony ZHANG. 138,795 views; 46 comments; 247 respects; Get. Apr 13, 2021 · Arduino Uno Example Sketch: Switch Case. Support. arduino, uno, switchcase. Travis_Foss March 1, 2019, 8:25pm #1. In this example the user will learn to use a switch case statement. A switch case statement is used in place of multiple if statements. When using a switch case, the program will take a variable, in the example below.

Arduino Project Hub. All products Amazon Alexa Official Arduino Skill Arduino 101 Arduino 4 Relays Shield Arduino ADK Rev. 3 Arduino Due Arduino Esplora Arduino Ethernet Rev. 3 Arduino Ethernet Shield 2 Arduino Gemma Arduino GSM shield V2 Arduino IDE Arduino IoT Cloud Arduino ISP Arduino LCD Screen Arduino Leonardo Arduino Leonardo With Headers. Wiring Limit Switches Arduino TutorialThe limit switches are used to detect the physical limits of the working area and to positionMore detail for GRBL CNC u.. Sie können in jeder Klausel mehrere Ausdrücke oder Bereiche Case verwenden. Die folgende Zeile ist beispielsweise gültig. Case 1 To 4, 7 To 9, 11, 13, Is > maxNumber. Hinweis. Das in den Anweisungen und verwendete Schlüsselwort ist nicht mit dem Is Case Case Else Is-Operatoridentisch, der für den Objektverweisvergleich verwendet wird. Sie können Bereiche und mehrere Ausdrücke für.

Arduino Programmierung: switch Anweisung - Technik Blo

Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. It only takes a minute to sign up. Sign up to join this community. Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top Arduino . Home Public; Questions; Tags Users Unanswered Find a Job; Jobs Companies Teams. Stack. To solve this, I make functions and place switches in the functions. In the future I hope it will be possible to use as much cases I need without running into this weird issue. The issue has nothing to do with memory shortage. The text was updated successfully, but these errors were encountered: Copy link

Arduino Tutorial Der switch- Befehl - Werde zum Maker mit

Die switch-Anweisung unterstützt den Musterabgleich ab C# 7.0. In C# 6 und früher verwenden Sie die switch-Anweisung mit den folgenden Einschränkungen: Ein Vergleichsausdruck muss einer der folgenden Typen sein: char, string, bool, ein integraler numerischer Typ oder ein enum-Typ. In case-Bezeichnungen sind nur konstante Ausdrücke zulässig Schleifen können Anweisungen bis zum Erreichen einer Abbruchbedingung wiederholen. for-SchleifeDie for-Schleife hat folgende Struktur: Als Parameter werden in den Klammern die Initialisierung (int i=0), die Abbruchbedingung(i<10) und die Fortsetzung (i++) übergeben. Sieh dir jetzt meinen neuen Arduino-Videokurs an: Jetzt ansehen! Alle Anweisungen, die in den geschweiften Klammern stehen. In case you use Arduino UNO, Arduino Duemilanove, Nano, Arduino Mega 2560, or Diecimila, you will need a standard USB cable (A plug to B plug), the kind you would connect to a USB printer as shown in the following image. In case you use Arduino Nano, you will need an A to Mini-B cable instead as shown in the following image Accepted Answer: Andrei Bobrov. I don't quite understand how to use the switch and case expressions to calculate when a variable is less than or greater than a particular value. Something like this: x = 7. switch x. case > 5. disp ('x is greater than 5') case < 5. disp ('x is less than 5'

Switch case in Arduino - tutorialspoint

Tutorial 14.5: Switch Case Statement - Programming ..

Arduino - SwitchCas

Arduino Project 2: LED w/ Switch. Now it's time to talk switches and how they can be incorporated into Arduino projects. A switch is a electrical component that completes a circuit when pushed and breaks the circuit when released. In this project, we will be using a small pushbutton switch to control an LED. Required Parts. Arduino Uno Boar If condition evaluates to the value that doesn't match any of the case: labels, and the default: label is present, control is transferred to the statement labeled with the default: label. The break statement, when encountered in statement exits the switch statement: switch(1) { case 1 : cout << '1'; // prints 1, case 2 : cout << '2'; // then.

Arduino IDE. The Arduino IDE is an open-source software, which is used to write and upload code to the Arduino boards. The IDE application is suitable for different operating systems such as Windows, Mac OS X, and Linux. It supports the programming languages C and C++. Here, IDE stands for Integrated Development Environment The Arduino, with its built-in ADC (analog-to-digital converter), then converts the analog voltage (from 0-5V) into a digital value in the range of (0-1023). When there is sufficient light in its environment or on its surface, the converted digital values read from the LDR through the Arduino will be in the range of 800-1023 2. Open Arduino IDE Software and write down your code, or download the code below and open it. 3. Choose your own Arduino board (in this case Arduino Uno), by selecting Tools > Board > Arduino/Geniuno Uno. 4. Choose your COM Port (usually it appears only one existing port), Tools > Port > COM.. (If there are more than one ports, try it one by.

Zahlenbereich in switch abfragen - social

Ein switch Statement wertet als erstes den Ausdruck aus. Danach wird nach der ersten case Klausel gesucht, die zu dem gleichen Wert ausgewertet wird wie der erste Ausdruck im switch (mit striktem Vergleich (en-US), ===) und springt im Kontrollfluss zu der Klausel und führt die dort geschriebenen Statements aus.(Bei mehrfachen Übereinstimmungen springt das Programm zu der ersten gefundenen. Arduino UNO is a microcontroller board based on the ATmega328P. It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz ceramic resonator, a USB connection, a power jack, an ICSP header and a reset button. It contains everything needed to support the microcontroller; simply connect it to a computer with a USB cable or power it with a AC-to-DC.

c# - Switch case: can I use a range instead of a one

When a case statement is found whose value matches that of the variable, the code in that statement is executed. After the statement is executed, we write the keyword break at the end of each case. The break statement tells the Arduino to stop the current switch statement and move on to another part of the program case arduino Code Answer's. arduino switch case . cpp by Splendid Scarab on Feb 07 2021 Donat Arduino UNO R3 board; Jump wires; We can use any color LED as per our choice. Principle. We will connect the four LEDs to pins 12, 11, 8, and 6 of the Arduino board. The resistors of 220 Ohm are connected in series with the LEDs. The switch statement will compare the declared value of a variable with statements in other cases. The code. Ich schreibe Code auf Arduino (sehr ähnlich wie C, was ich nicht weiß, oder sehr wenig), und ich habe ein kleines Problem bezüglich der Switch / Case-Aussage. Ich brauche mein Arduino, um dies oder das zu tun, abhängig von den Werten eines Potentiometers (0 bis 1023). Ich habe jedoch keine Ahnung, wie ich den Fall 0 bis 200 sagen soll. Fig. 1 shows the test setup for this series, in this case an Arduino Nano. I'll assume one can program their Arduino board. The Nano and most Arduino boards today have an LED on digital pin 13 (DP13). The use of the I2C LCD display is optional but makes understanding the process easier. This uses three LEDs on DP9, DP10, DP11. Two normally open push button switches are connected to DP2 and DP3.

Arduino toggle Switch: How to use a push button as a toggle switch - and make it reliable. Most web Arduino toggle switch examples don't give you correct toggle swicth operation because they ignore the real operation of all switches. Read more. Arduino joystick tutorial: how to setup and use one on the Arduino - Let's consider the c case: 5 V 1 A are needed, since 200 mA are allocated to Arduino and 800 mA to the 5 V peripherals; for example there can be a 9 V source with a deliverable power that has to be about 20-30% more, for example a 9 V 1,5 A or 2 A regulated power supply; it will be enough to create a small board with an input that is compatible with the power supply jack, below it. Learn: how to debounce for button in Arduino, How to do button debounce using millis() function, how to program Arduino step by step. The detail instruction, code, wiring diagram, video tutorial, line-by-line code explanation are provided to help you quickly get started with Arduino. Find this and other Arduino tutorials on ArduinoGetStarted.com Silicone sleeve Arduino Nano 33 BLE Sense. €5,00. | /. The Arduino Nano 33 BLE Sense Protective Silicone Case is designed to perfectly fit your Arduino Nano 33 BLE Sense, and to protect it in case of adventurous experiments. Take full advantage of the motion sensors on your board, protect it against impact with the silicon case, and launch. In C or C++, we have used the switch-case statement. In the switch statement we pass some value, and using different cases, we can check the value. Here we will see that we can use ranges in the case statement. The syntax of using range in Case is like below −. After writing case, we have to put lower value, then one space, then three dots.

Im letzten Kapitel der Tutorial reihe zur Arduino Programmierung habe ich die Schleifen vorgestellt, nun möchte ich auf die Abfragen eingehen. Abfragen werden benötigt, um auf bestimmte Zustände eines Booleschen Ausdrucks einzugehen. D.h. kurz gesagt, wenn ein Ausdruck WAHR oder FALSCH ist, dann mache folgendes. Arduino ist eine Open-Source-Elektronik-Prototyping-Plattform für flexible, einfach zu bedienende Hardware und Software im Bereich Mikrocontrolling. Es ist geeignet, um in kurzer Zeit spektakuläre Projekte zu verwirklichen. Viele davon lassen sich unter dem Begriff Arduino bei Youtube finden. Es wird vor allem von Künstlern, Designern, Tüftlern und Bastlern verwendet, um kreative. C# Switch Case Statement Example. Following is the example of using switch statements in the c# programming language. Console.WriteLine(Press Enter Key to Exit..); If you observe the above example, we defined a switch with multiple case statements, and it will execute the matched case statements with the expression value *Note: The above tutorial is for Arduino interfacing. There's a touch sensor raspberry pi guide on our wiki page as well! Summary. That's all for today on touch sensors. I hope with today's blog, you get a deeper understanding of what it is, how it works, and what it takes to build one with an Arduino In our case: DNC - white wires; VCC - red wire; TX - blue wire; RX - green wire; GND - black wire; The following table shows how to wire the sensor to the Arduino. Fingerprint Sensor: Arduino : VCC: 5V (it also works with 3.3V) TX: RX (digital pin 2, software serial) RX: TX (digital pin 3, software serial) GND: GND: Installing the Adafruit Fingerprint Sensor Library. The easiest way.

Tutorial 14: Arduino Switch Case Statements and Keyboard

Learn how to use ultrasonic sensor HC-SR04 with Arduino, how ultrasonic sensor works, how to connect ultrasonic sensor to Arduino, how to code for ultrasonic sensor, how to program Arduino step by step. The detail instruction, code, wiring diagram, video tutorial, line-by-line code explanation are provided to help you quickly get started with Arduino Here is Arduino method to split a String as answer to the question How to split a string in substring? declared as a duplicate of the present question. The objective of the solution is to parse a series of GPS positions logged into a SD card file. Instead of having a String received from Serial, the String is read from file. The function is StringSplit() parse a String sLine = 1.12345,4. The default statement is often placed at the end, but it can appear anywhere in the switch statement body. A case or default label can only appear inside a switch statement. The constant-expression in each case label is converted to a constant value that's the same type as condition. Then, it's compared with condition for equality. Control passes to the first statement after the case constant. You can experiment with smaller objects to find the best wave reflection angle so that the Arduino receives the correct distance. Using a Transistor as a Switch. The transistor is a very versatile electronic component. It can be used for switching, amplification, filtering, buffers, and regulators. In this case, we will be using it as a switch Arduino: switch-Befehle verwenden. Der switch-Befehl testet, ob der Wert einer Variable einem bestimmten Wert gleicht. Jeden Wert nennt man hierbei case. Wir haben an dieser Stelle bereits mit dem Befehl »int day = 3;« eine Variable definiert. Nun möchten wir einen switch-Befehl einfügen. Als Erstes schreiben Sie dafür den Befehl »switch (day) {«. Danach wird mit dem Befehl »case 1.

How can I use ranges in a switch case statement using

These cases protect your Arduino Uno from things like rogue wires that might short it out while still allowing full access to board! Simply snap Uno into the bottom half of the enclosure, then snap two sides together. As you may have notice, these Arduino enclosures are actually opaque black color. Enclosures are perfect for blending your Uno into black surface, giving your project a sleeker. I would like to have a power switch which turns on the LEDs. I would like the LEDs to light up only one at a time. I would like to be able to press a button and make each LED light up in turn, in other words pressing the button changes which LED is powered. I have only just started with Arduino so not sure how to go about something like that. This function takes three arguments, one for the brightness of the red, green and blue LEDs. In each case the number will be in the range 0 to 255, where 0 means off and 255 means maximum brightness. The function then calls 'analogWrite' to set the brightness of each LED So, if we measure the output voltage of LM35 Temperature Sensor, then we can measure the temperature with a simple calculation. T in 0 C = V OUT / 10mV. First, connect the power supply to the sensor i.e., +5V to +V S pin and GND to GND pin respectively. Now, take a digital multimeter and set it to measure DC Voltage This pin is rarely used, it tells the Arduino how to configure the voltage range of the analog pins. Some Arduino boards have more pins to the left of AREF. Since these are not in all boards I will not discuss them here. On the bottom right we have six pins labeled 0 to 5. These are the analog input pins. Unlike the digital pins which have only two possible states, an analog pin can have 1024.

ARDUINO BASICS #12 - Methoden und Switch Case - YouTub

Using jumper wires, connect the positive lead to Arduino digital pin 8. The case of the buzzer may have a positive sign (+) on it to indicate the positive lead (if not, then the red wire usually indicates the positive lead). Connect the other lead to the 100 ohm resistor, and then to ground. That's it. Let's go ahead and jump into the Arduino sketch. The basics and more of using the tone. Switch case can act upon enum values. Enums are useful if the program has to use magic constants. In the above program the IsImportant method uses five explicit cases and a default case. Here the switch tests the parameter that is an enum of type Priority. True is returned if the Priority value is Important or Critical. Otherwise false is returned. You can learn more about enums in C# with.

switch case Arduino Referenc

Arduino Simulator. The Arduino simulator is a virtual portrayal of the circuits of Arduino in the real world. We can create many projects using a simulator without the need for any hardware. The Simulator helps beginner and professional designers to learn, program, and create their projects without wasting time on collecting hardware equipments In their case, they need to make an element on a poster move when someone walks within three feet of the ultrasonic sensor. The class decided to utilize HC-SR04 Ultrasonic Sensor, Small Servo, and an Arduino clone from some kits that SainSmart generously donated to the class about two years ago. Before we get started, I want to take a moment and talk about The Young Makers of Greater Augusta. Arduino Temperature Controller Circuit. Circuit is constructed using Arduino Uno and LM35 temperature sensor and other components. We are using 16×2 LCD to display current temperature and set points. LM35 gives analog output proportional to the temperature which is given to Arduino analog input A0. Which is then compared with set points if it. In that case, you should replace the 10KΩ pulldown with a 1KΩ pulldown. In that case, it will not be able to detect dark level differences as well but it will be able to detect bright light differences better. This is a tradeoff that you will have to decide upon! You can also use the Axel Benz formula by first measuring the minimum and maximum resistance value with the multimeter and then. Move the rc_switch folder to your Arduino IDE installation libraries folder; Then, re-open your Arduino IDE; Opening the Decoder Sketch . You need to decode the signals that your remote control sends, so that the Arduino or ESP8266 can reproduce those signals and ultimately control the outlets. The library comes with several sketch examples. Within the Arduino IDE software, you need to go to.

As like most devices, we make use of an Arduino library, in this case <wire.h>. Then use the function Now let's use our I2C knowledge by controlling a range of devices The Microchip MCP4018T digital linear potentiometer. The value of this model is 10 kilo ohms. Inside this tiny, tiny SMD part is a resistor array consisting of 127 elements and a wiper that we control by sending a value. Accelerometer Demo. This first demo will show you how to get readings of what an accelerometer does best: measure acceleration! Open up File -> Examples -> Adafruit LSM303 Accel-> accelsensor and upload to your Arduino wired up to the sensor. Upload the sketch to your board and open up the Serial Monitor ( Tools -> Serial Monitor) at 115200 baud A little bit counter intuitive, but to stay in the loop, 'i' can only range from 0 to 9, at 10 it exits. You can use the 'i' variable in later code as well. Parameters of the Arduino for loop Initialise . int i = 0; First of all the variable 'i' is created (if it does not already exist) and set to zero. This section of the for-loop is only executed once at the beginning. Test . i < 10; Next.