Skip to content

Instantly share code, notes, and snippets.

View EdITSWORLD's full-sized avatar

EdITS WORLD EdITSWORLD

View GitHub Profile
@EdITSWORLD
EdITSWORLD / Interfacing STMicroelectronics LIS3DH accelerometer with the STM32 Microcontroller.c
Last active April 16, 2023 13:33
STM32 - Interfacing STMicroelectronics LIS3DH accelerometer with the STM32 Microcontroller
#include "stm32f4xx_hal.h"
#include "stdio.h"
#define LIS3DH_ADDRESS 0x18 // I2C address of LIS3DH accelerometer
I2C_HandleTypeDef hi2c1; // I2C interface handle
UART_HandleTypeDef huart2; // UART interface handle
void SystemClock_Config(void);
void print_acceleration(float ax, float ay, float az);
@EdITSWORLD
EdITSWORLD / STM32Fx Eight LED Interfacing.c
Last active March 19, 2023 17:59
STM32Fx Eight LED Interfacing
#include "stm32f10x.h" // Include the STM32F10x header file
int main(void)
{
// Enable clock for GPIO port C
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE);
// Initialize GPIO pins for LED outputs
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7;
@EdITSWORLD
EdITSWORLD / Arduino with Proximity Sensor for Industrial Applications.c
Created March 19, 2023 16:38
Arduino with Proximity Sensor for Industrial Applications
const int PROXIMITY_SENSOR_PIN = 2; // digital pin for proximity sensor input
const int LED_PIN = 13; // digital pin for LED output
int sensorValue = 0; // variable to store sensor value
void setup() {
pinMode(PROXIMITY_SENSOR_PIN, INPUT); // set the proximity sensor pin as input
pinMode(LED_PIN, OUTPUT); // set the LED pin as output
Serial.begin(9600); // initialize serial communication at 9600 baud rate
}
void loop() {
sensorValue = digitalRead(PROXIMITY_SENSOR_PIN); // read digital sensor value
@EdITSWORLD
EdITSWORLD / Interfacing an LDR with Arduino using Analog Input.c
Created March 19, 2023 15:37
Interfacing an LDR with Arduino using Analog Input
const int LDR_PIN = A0; // analog pin for LDR input
int LDR_value = 0; // variable to store LDR value
void setup() {
Serial.begin(9600); // initialize serial communication at 9600 baud rate
}
void loop() {
LDR_value = analogRead(LDR_PIN); // read LDR value
Serial.print("LDR Value: "); // print LDR value to serial monitor
@EdITSWORLD
EdITSWORLD / How to Interface eight LED with Arduino.c
Created March 18, 2023 17:47
How to Interface eight LED with Arduino
void setup() {
  // set all digital pins from 2 to 9 as outputs
  for (int i = 2; i <= 9; i++) {
    pinMode(i, OUTPUT);
  }
@EdITSWORLD
EdITSWORLD / LED Interfacing with Arduino.c
Last active March 18, 2023 17:42
LED Interfacing with Arduino
void setup() {
pinMode(13, OUTPUT); // set digital pin 13 as output
}
void loop()
{
digitalWrite(13, HIGH); // turn on the LED
delay(1000); // wait for 1 second
digitalWrite(13, LOW); // turn off the LED
delay(1000); // wait for 1 second
}
@EdITSWORLD
EdITSWORLD / Arduino - Simple Traffic Light Program.c
Last active March 18, 2023 11:38
Arduino - Simple Traffic Light Program.c
void setup() {
pinMode(2, OUTPUT); // set red LED pin as output
pinMode(3, OUTPUT); // set yellow LED pin as output
pinMode(4, OUTPUT); // set green LED pin as output
}
void loop() {
digitalWrite(2, HIGH); // turn on red LED
delay(5000); // wait for 5 seconds
@EdITSWORLD
EdITSWORLD / IIoT-LDR Interfacing with Arduino and generate delay.c
Last active January 30, 2020 11:05
IIoT-LDR Interfacing with Arduino and generate delay
int sensorValue = 0;
void setup()
{
pinMode(A0, INPUT);
pinMode(13, OUTPUT);
Serial.begin(9600);
}
void loop()
{
// read the value from the sensor
@EdITSWORLD
EdITSWORLD / IIoT-Digital Alarm Clock.c
Last active December 6, 2019 09:54
IIoT-Digital Alarm Clock
#include<LiquidCrystal.h>
#define RS 9
#define E 8
#define D4 4
#define D5 5
#define D6 6
#define D7 7
#define MENU 3
#define FIRST 1
#define SECOND 2
@EdITSWORLD
EdITSWORLD / IIOT - Interface LDR with Arduino to work as a switch.c
Created November 14, 2019 12:31
IIOT - Interface LDR with Arduino to work as a switch
int LDR_Value = 0;
int LDR_Value1=0;
void setup()
{
pinMode(A1, INPUT);
pinMode(13, OUTPUT);
Serial.begin(9600);
}