Skip to content

Instantly share code, notes, and snippets.

View VojislavM's full-sized avatar
🔌
Live

Vojislav Milivojevic VojislavM

🔌
Live
View GitHub Profile
@gbaman
gbaman / HowToOTG.md
Last active November 3, 2024 17:19
Simple guide for setting up OTG modes on the Raspberry Pi Zero

Raspberry Pi Zero OTG Mode

Simple guide for setting up OTG modes on the Raspberry Pi Zero - By Andrew Mulholland (gbaman).

The Raspberry Pi Zero (and model A and A+) support USB On The Go, given the processor is connected directly to the USB port, unlike on the B, B+ or Pi 2 B, which goes via a USB hub.
Because of this, if setup to, the Pi can act as a USB slave instead, providing virtual serial (a terminal), virtual ethernet, virtual mass storage device (pendrive) or even other virtual devices like HID, MIDI, or act as a virtual webcam!
It is important to note that, although the model A and A+ can support being a USB slave, they are missing the ID pin (is tied to ground internally) so are unable to dynamically switch between USB master/slave mode. As such, they default to USB master mode. There is no easy way to change this right now.
It is also important to note, that a USB to UART serial adapter is not needed for any of these guides, as may be documented elsewhere across the int

@bbx10
bbx10 / esp-wunderground.ino
Created October 29, 2015 15:05
ESP8266 get weather from Weather Underground
/****************************
The MIT License (MIT)
Copyright (c) 2015 by [email protected]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@jrmedd
jrmedd / LatestArduinoIDE.cpp
Last active May 16, 2020 10:50
Replace '#include "WProgram.h"' with this code to make libraries compatible with latest Arduino IDE.
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include <Wire.h>
/*Replace #include "WProgram.h" with the above code to make compatible with
latest Arduino IDE.*/
@dbrockman
dbrockman / degrees-radians.h
Created February 12, 2013 21:52
Convert degrees <-> radians C macros
// Converts degrees to radians.
#define degreesToRadians(angleDegrees) (angleDegrees * M_PI / 180.0)
// Converts radians to degrees.
#define radiansToDegrees(angleRadians) (angleRadians * 180.0 / M_PI)
@joshgachnang
joshgachnang / gist:2306795
Last active April 30, 2024 03:34
Bash Check Username of User Running Script
if [ "$(whoami)" != "username" ]; then
echo "Script must be run as user: username"
exit 255
fi