Hirdetés
- Luck Dragon: Asszociációs játék. :)
- Ndruu: Segíts kereshetővé tenni a PH-s arcképeket!
- GoodSpeed: 3I/Atlas: Üstökös vagy idegen civilizáció űrhajója?
- Sub-ZeRo: Euro Truck Simulator 2 & American Truck Simulator 1 (esetleg 2 majd, ha lesz) :)
- gban: Ingyen kellene, de tegnapra
- kraftxld: Diáklaptop - Dell Latitude 3140 - Királyunk ajándéka
- sziku69: Fűzzük össze a szavakat :)
- sh4d0w: Árnyékos sarok
- droidic: Gmail + MI: na, mi van bekapcsolva?
- NASsoljunk: ZyXEL NSA-310 és az FFP
-
LOGOUT
Arduino hardverrel és szoftverrel foglakozó téma. Minden mikrovezérlő ami arduinoval programozható, és minden arduino program, board, és hardverrel kapcsolatos kérdések helye.
Új hozzászólás Aktív témák
-
lanszelot
addikt
Hello,
Itt tökéletesen működik a buzzer, rövid csip, hosszú szünet, 3szor
#include <TimerOne.h>
#include <Wire.h>
#include <MultiFuncShield.h>
void setup() {
// put your setup code here, to run once:
Timer1.initialize();
MFS.initialize(&Timer1); // initialize multi-function shield library
// NOTE beep control is performed in the background, i.e. beep() is non blocking.
// short beep for 200 milliseconds
MFS.beep();
delay(1000);
// 4 short beeps, repeated 3 times.
MFS.beep(15, // beep for 50 milliseconds
150, // silent for 50 milliseconds
3, // repeat above cycle 4 times
1, // loop 3 times
50 // wait 500 milliseconds between loop
);
}
void loop() {
// put your main code here, to run repeatedly:
}itt viszont rosszul működik, rövid csip, rövid szünet, 1szer
#include <TimerOne.h>
#include <Wire.h>
#include <MultiFuncShield.h>
int trigPin = 40; // Trigger
int echoPin = 41; // Echo
long duration, cm, inches;
void setup() {
//Serial Port begin
Serial.begin (9600);
//Define inputs and outputs
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
Timer1.initialize();
MFS.initialize(&Timer1);
}
void loop() {
// The sensor is triggered by a HIGH pulse of 10 or more microseconds.
// Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
digitalWrite(trigPin, LOW);
delayMicroseconds(5);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
// Read the signal from the sensor: a HIGH pulse whose
// duration is the time (in microseconds) from the sending
// of the ping to the reception of its echo off of an object.
pinMode(echoPin, INPUT);
duration = pulseIn(echoPin, HIGH);
// Convert the time into a distance
cm = (duration/2) / 29.1; // Divide by 29.1 or multiply by 0.0343
inches = (duration/2) / 74; // Divide by 74 or multiply by 0.0135
MFS.write((int)cm);
Serial.print(inches);
Serial.print("in, ");
Serial.print(cm);
Serial.print("cm");
Serial.println();
if (cm <= 30 && cm > 20) {
MFS.beep(15, // beep for 50 milliseconds
150, // silent for 50 milliseconds
3, // repeat above cycle 4 times
1, // loop 3 times
50 // wait 500 milliseconds between loop
);
}else if (cm <= 20 && cm > 10) {
MFS.beep();
}else if (cm <= 10) {
MFS.beep(35, // beep for 50 milliseconds
1, // silent for 50 milliseconds
1, // repeat above cycle 4 times
1, // loop 3 times
1 // wait 500 milliseconds between loop
);
}
delay(250);
}Miért rossz a másodikban?
olyan mintha az első "else if" futna le 30-20 között is, nem pedig az "if"
de nem értem miért
Új hozzászólás Aktív témák
- TCL LCD és LED TV-k
- Kezdő fotósok digitális fényképei
- Hivatalos a OnePlus 13 startdátuma
- World of Tanks - MMO
- Megtartotta Európában a 7500 mAh-t az Oppo
- iPhone topik
- Milyen TV-t vegyek?
- Azonnali informatikai kérdések órája
- One otthoni szolgáltatások (TV, internet, telefon)
- Revolut
- További aktív témák...
- Bomba ár! Dell Latitude 3410 - i3-10110U I 8GB I 256SSD I HDMI I 13,3" FHD Touch I Cam I W11 I Gari
- Bomba ár! Dell Latitude E5550 - i5-5GEN I 8GB I 128SSD I 15,6" FHD Touch I HDMI I W10 I Cam I Gari!
- Bomba ár! Dell Latitude E5540 - i5-4GEN I 4GB I 240SSD I Nvidia I 15,6" FHD I Cam I W10 I Garancia!
- Olcsón Google Nest Mini 2nd Gen
- Bomba ár! Dell Latitude E5530 - i5-3GEN I 4GB I 320GB I HDMI I 15,6" HD I W10 I Gari!
- Samsung Galaxy S22 Ultra / 12/256GB / Kártyafüggetlen / 12Hó Garancia
- LG 27GR95UM - 27" MiniLED - UHD 4K - 160Hz 1ms - NVIDIA G-Sync - FreeSync Premium PRO - HDR 1000
- Airpods Max fülpárna, gyári Apple
- HIBÁTLAN iPhone 13 Pro Max 256GB Gold -1 ÉV GARANCIA -Kártyafüggetlen, MS3758, 100% Akkumulátor
- Samsung Bluetooth Mouse Slim egér
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest
ekkold
