Created at 6am, Jan 6
tuna007Technology
0
Arduino programing
qa-N-ovQ_qiVFVkh9ipb83ebJBnTbfsLogbOXFIEklA
File Type
PDF
Entry Count
33
Embed. Model
jina_embeddings_v2_base_en
Index Type
hnsw
Sensors and Actuators The sensors and actuators can be either digital or analog. Some sensors and actuators have been made for Arduino, while others need to be connected in some circuit to work properly with Arduino. Many of these come with ready-made libraries for Arduino, so they are easy to use. Sensors Examples 1. Electrical Circuit Example 2. Blinking LED Example 3. Switch Example 4. Potentiometer Example 5. Temperature Example 6. Light Sensor Example 7. Thermistor Example Hans-Petter Halvorsen Actuators 2018.10.16 31 | Programmering with Arduino | 2018.10.16 Play and Explore |Programming with Arduino| Example 1 TRY IT OUT! Electrical Circuits Hans-Petter Halvorsen 32 | Programmering with Arduino | Electrical Cuicits Lets create the following cuircit: + Instead of using a Battery we will use the Arduino board as a Power Supply (5V) Power Supply Example 1 Light-Emitting Diode LED [Wikipedia] Hans-Petter Halvorsen 2018.10.16 Light 33
id: abb58b6898647097718f2db960aa8771 - page: 33
| Programmering with Arduino | 2018.10.16 Introduction We will use the POWER ports 5V and GND on the Arduino board GND = Ground Example 1 Electrical Cuircuit TRY IT OUT! Make the following circuit using the Arduino board and a Breadboard: Equipment: Breadboard LED Resistor Wires Multi-meter LED % = 270 + ! = 5$ Example 1 Note! No Arduino Program is needed in this example Hans-Petter Halvorsen 34 | Programmering with Arduino | Why do you need a Resistor? If the current becomes to large, the LED will be destroyed. To prevent this to happen, we will use a Resistor to limit the amount of current in the cuircuit. What should be the size of the Resistor? A LED typically need a current like 20mA (can be found in the LED Datasheet). We use Ohms Law: ! = #$ Arduino gives U=5V and I=20mA. We then get: # = ! $ %& '.')* The Resistor needed will be # = so we can use the closest Resistors we have, e.g., 270 = 250. Resistors with R=250 is not so common, Example 1
id: 7057a468defe21573da98ae2d197ef4a - page: 36
Find the Resistor Size Find the correct Resistor by using the Color Codes or a Mult-meter: You may also use a Resistor Calculator which you find online: Example 1 Hans-Petter Halvorsen 2018.10.16 35 | Programmering with Arduino | Make sure to connect the LED correctly. The legs have different lengths Example 1 g n i r i W Example 1 Hans-Petter Halvorsen Wiring 2018.10.16 + Use a Breadboard see next page TRY IT OUT! Make sure to connect the LED correctly. The legs have different lengths Note! Use a Resistor ! = 270 to protect the LED 36 | Programmering with Arduino | Play and Explore |Programming with Arduino| |Programming with Arduino| Hans-Petter Halvorsen 2018.10.16 37 | Programmering with Arduino | Example 2 Blinking LED Light-emitting diode LED [Wikipedia] Hans-Petter Halvorsen 2018.10.16 TRY IT OUT! 38 | Programmering with Arduino |
id: 3367be1b3ad61f01c06e4673e0b5f1ed - page: 37
Introduction We will make a program that makes the LED start blinking. How-To Do it: 1. Wire the cuircuit and components 2. Make the Arduino program Example 2 Equipment Arduino UNO Breadboard LED Resistor, ! = 270 Wires (Jumper Wires) Example 2 Hans-Petter Halvorsen 2018.10.16 39 | Programmering with Arduino | Example 2 Program Structure //Globale variable ... void setup() { //Initialization } void loop() { //Main Program } Example 2 Hans-Petter Halvorsen 2018.10.16 Wiring TRY IT OUT! Programming You need to use the following: Which Pin (0, 1, 3, ...) are you using? pinMode(pin, mode); A Digital Pin can either be an INPUT or an OUTPUT. Since we shall use it to turn-on a LED, ww set it to OUTPUT. digitalWrite(pin, value); Turn-on LED Turn-off LED A Digital PIn can have 2 values, either HIGH or LOW delay(ms); The delay() fuction make a small pause in milliseconds (ms), e.g,. delay(1000) pause the program for 1 second
id: eea8ccf23a5e773db88f140ecbb8977d - page: 41
How to Retrieve?
# Search

curl -X POST "https://search.dria.co/hnsw/search" \
-H "x-api-key: <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{"rerank": true, "top_n": 10, "contract_id": "qa-N-ovQ_qiVFVkh9ipb83ebJBnTbfsLogbOXFIEklA", "query": "What is alexanDRIA library?"}'
        
# Query

curl -X POST "https://search.dria.co/hnsw/query" \
-H "x-api-key: <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{"vector": [0.123, 0.5236], "top_n": 10, "contract_id": "qa-N-ovQ_qiVFVkh9ipb83ebJBnTbfsLogbOXFIEklA", "level": 2}'