Skip to content

Instantly share code, notes, and snippets.

View sdrshnptl's full-sized avatar
🎯
Focusing

Sudarshan Patil sdrshnptl

🎯
Focusing
View GitHub Profile
@sdrshnptl
sdrshnptl / mqtt_ssl_idf.ino
Created May 15, 2023 03:14 — forked from gmag11/mqtt_ssl_idf.ino
Secure MQTT connection to broker with ESP32 and internal IDF mqtt client library
#include "Arduino.h"
#include <WiFi.h>
#include "esp_log.h"
#include "esp_system.h"
#include "esp_event.h"
#include "mqtt_client.h"
#define SECURE_MQTT // Comment this line if you are not using MQTT over SSL
#ifdef SECURE_MQTT
@sdrshnptl
sdrshnptl / pico-serial.inf
Created June 12, 2022 04:56
Raspberry pi pico rp2040 CDC USB serial driver
[DeviceList]
%PI_CDC_PICO%=DriverInstall, USB\VID_2E8A&PID_0005&MI_00
[DeviceList.NTAMD64]
%PI_CDC_PICO%=DriverInstall, USB\VID_2E8A&PID_0005&MI_00
[DeviceList.NTIA64]
%PI_CDC_PICO%=DriverInstall, USB\VID_2E8A&PID_0005&MI_00
[DeviceList.NT]
@sdrshnptl
sdrshnptl / platformio.ini
Last active October 26, 2021 10:19
Arduino DUE jtag segger j-link SWD in VS Code platformio
[env:due]
platform = atmelsam
board = due
framework = arduino
monitor_speed = 115200
;upload_speed = 115200
debug_build_flags = -O1 -ggdb3 -g3 ;//Resolve compile issue
debug_tool = custom ;//j-link segger in SWD mode
@sdrshnptl
sdrshnptl / mapf.ino
Created January 12, 2021 11:35 — forked from nadavmatalon/mapf.ino
ARDUINO: MAP FLOAT FUNCTION
double mapf(double val, double in_min, double in_max, double out_min, double out_max) {
return (val - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
@sdrshnptl
sdrshnptl / arduino bitshift BCD 20210102.ino
Last active January 2, 2021 05:21
Arduino binary to decimal using bit shift
int a,b,c,d;
int i;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
for(i = 0; i < 16 ; i++)
{
@sdrshnptl
sdrshnptl / NodeMCU_LED_ON_OFF.ino
Last active September 16, 2017 12:38
Toggle LED from NodeMCU using WIFI.
/*
open browser and hit
192.168.1.167/?1 to ON
192.168.1.167/?0 to OFF
*/
#include <ESP8266WiFi.h>
@sdrshnptl
sdrshnptl / gist:cce5932231c65215e1ec3fb44c477900
Last active March 8, 2017 08:22
Predefined Macros in embedded C
/*
__DATE__ The current date as a character literal in "MMM DD YYYY" format.
__TIME__ The current time as a character literal in "HH:MM:SS" format.
__FILE__ This contains the current filename as a string literal.
__LINE__ This contains the current line number as a decimal constant.
__STDC__ Defined as 1 when the compiler complies with the ANSI standard.
*/
#include <stdio.h>
@sdrshnptl
sdrshnptl / left shift arrays
Last active March 7, 2017 10:36
Shift array values to one position left for continuous input averaging.
#include <stdio.h>
int main()
{
int marks[10]={0,1,2,3,4,5,6,7,8,9},i;
for(i=0; i<11; ++i)
{
printf("%d ",marks[i]);
}
while(1)
{