Posts

Gas leak detector project with free code and circuit diagram

Image
Arduino Code- https://github.com/futuristiciox/gas_leak_detector #include <Servo.h> const int gasSensorPin = A0;   // Analog pin connected to the MQ2 gas sensor const int ledPin = 12 ; const int servoPin = 3 ;   // Digital pin connected to the servo const int buzzerPin = 10 ;   // Digital pin connected to the buzzer const int exhaustFanPin = 9 ; const int homeLightInterlockPin = 8 ; const int gasThreshold = 400 ;   // Threshold value for gas detection (adjust based on your testing) Servo myServo;           // Create servo object to control a servo bool alarmFlag = false ;   // Flag to check if the servo has already moved void setup () {    myServo . attach ( servoPin ) ;    myServo . write ( 0 ) ;   // Initial position of the servo    pinMode ( gasSensorPin, INPUT ) ;    pinMode ( ledPin, OUTPUT ) ;    pinMode ( buzzerPin, OUTPUT ) ;    pinMode ( exhaustFanPin, OUTPUT ) ;    pinMode ( homeLightInterlockPin, OUTPUT ) ;    digitalWrite ( homeLightInterlockPin, H

Raspberrypi pico Traffic lights project with buzzer

Image
Building a Traffic Light System with MicroPython and Raspberrypi pico Code and Circuit-  https://github.com/futuristiciox/rpi-pico-traffic-lights-with-puffin-crossing import machine import utime import _thread led_red = machine.Pin(15, machine.Pin.OUT) led_amber = machine.Pin(14, machine.Pin.OUT) led_green = machine.Pin(13, machine.Pin.OUT) button = machine.Pin(16, machine.Pin.IN,machine.Pin.PULL_DOWN) buzzer = machine.Pin(12, machine.Pin.OUT) global button_pressed button_pressed = False def button_reader_thread():     global button_pressed     while True:         if button.value() == 1:             button_pressed = True _thread.start_new_thread(button_reader_thread, ()) while True:     if button_pressed == True:         led_red.value(1)         for i in range(10):             buzzer.value(0)             utime.sleep(0.2)             buzzer.value(1)             utime.sleep(0.2)         global button_pressed         button_pressed = False     led_red.value(1)     utime.sleep(5)     led_r