Hirdetés
- Samsung Galaxy S25 - végre van kicsi!
- Okosóra és okoskiegészítő topik
- Honor 200 Pro - mobilportré
- Honor Magic6 Pro - kör közepén számok
- Samsung Galaxy Ring - gyűrű-kúra
- Samsung Galaxy S23 Ultra - non plus ultra
- EarFun Air Pro 4+ – érdemi plusz
- Samsung Galaxy S25 Ultra - titán keret, acélos teljesítmény
- Bekerül az Apple Pay és Google Pay a Budapest GO alkalmazásba
- Apple Watch
-
Mobilarena
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
- Vigneau interaktív lokálblogja
- Sütés, főzés és konyhai praktikák
- Temu
- TCL LCD és LED TV-k
- Kávé kezdőknek - amatőr koffeinisták anonim klubja
- Milyen notebookot vegyek?
- 5.1, 7.1 és gamer fejhallgatók
- AliExpress tapasztalatok
- Milyen NAS-t vegyek?
- Teljes verziós játékok letöltése ingyen
- További aktív témák...
- Magyar menüs Delonghi Magnifica S cappuccino automata kávéfőző tejtartállyal
- SAMSUNG PM9E1 "9100 PRO" 2 TB M.2 NVME PCI-E 5.0 x4 - Új - 14.000-12.500 MBs - Eladó!
- Forza Horizon Xbox Limited Edition Controller Új! Bontatlan!!
- GAINWARD GeForce RTX 4070 Ghost 12GB GARANCIÁLIS, DOBOZZAL, SZÁMLÁVAL
- Asus ExpertBook B1403 Core i7 notebook bontatlan dobozában eladó
- AKCIÓ! Honor 200 Lite 8GB 256GB mobiltelefon garanciával hibátlan működéssel
- iKing.Hu-Nothing Phone 3a Pro Grey Glyph stílus, 3 optikai zoom 12/256 GB -3 hónap garancia
- HIBÁTLAN iPhone 12 mini 64GB Red -1 ÉV GARANCIA - Kártyafüggetlen, MS2036
- 200db SZETT! REFURBISHED - DELL Docking Station WD19S + 130W töltő
- GYÖNYÖRŰ iPhone 12 mini 128GB Blue -1 ÉV GARANCIA - Kártyafüggetlen, MS3854,94% Akkumulátor
Állásajánlatok
Cég: BroadBit Hungary Kft.
Város: Budakeszi
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest
ekkold

