Soil Moisture sensor with Arduino in Tinkercad | how to use soil moisture sensor in Tinkercad Circuit diagram: Arduino Sketch: // C++ code // int moisture_data = 0; void setup() { pinMode(A0, INPUT); Serial.begin(9600); pinMode(12, OUTPUT); pinMode(6, OUTPUT); } void loop() { moisture_data = analogRead(A0); Serial.println(moisture_data); if (moisture_data < 21) { digitalWrite(12, HIGH); digitalWrite(6, HIGH); } else { digitalWrite(12, LOW); digitalWrite(6, LOW); } delay(10); // Delay a little bit to improve simulation performance }
Security system using Arduino and Ultrasonic sensor Arduino Sketch for the same project is given below: //this code is created by Yogesh Bawane for my channel ImpulseTech. //you will find arduino tutorial on this channel https://www.youtube.com/channel/UCHCzBGgDMjT3fOWCv1ruIdA const int pingPin = 7; // Trigger Pin of Ultrasonic Sensor const int echoPin = 6; int buzzer=5;// Echo Pin of Ultrasonic Sensor void setup() { Serial.begin(9600); // Starting Serial Terminal pinMode(buzzer,OUTPUT); } void loop() { long duration, inches, cm; pinMode(pingPin, OUTPUT); digitalWrite(pingPin, LOW); delayMicroseconds(2); digitalWrite(pingPin, HIGH); delayMicroseconds(10); digitalWrite(pingPin, LOW); pinMode(echoPin, INPUT); duration = pulseIn(echoPin, HIGH); inches = microsecondsToInches(duration); cm = microsecondsToCentimet...