Skip to content

Instantly share code, notes, and snippets.

@DzikuVx
DzikuVx / read_rc_pwm.ino
Created January 5, 2016 19:41
Read RC PWM signal with Arduino
#include <PinChangeInterrupt.h>
/*
* Define pins used to provide RC PWM signal to Arduino
* Pins 8, 9 and 10 are used since they work on both ATMega328 and
* ATMega32u4 board. So this code will work on Uno/Mini/Nano/Micro/Leonardo
* See PinChangeInterrupt documentation for usable pins on other boards
*/
const byte channel_pin[] = {8, 9, 10};
volatile unsigned long rising_start[] = {0, 0, 0};
import RPi.GPIO as GPIO
import time
def main():
# GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.OUT)
GPIO.output(18, GPIO.HIGH)
#include <Servo.h>
Servo servo;
const int PIN_BUTTON = 6;
const int PIN_SERVO = 5;
int pos = 1500;
int prevButtonState = HIGH;
@DzikuVx
DzikuVx / ocp.php
Last active August 29, 2015 14:21 — forked from ck-on/ocp.php
<?php
/*
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)
Author: _ck_ (with contributions by GK, stasilok)
Version: 0.1.6
Free for any kind of use or modification, I am not responsible for anything, please share your improvements
* revision history
0.1.6 2013-04-12 moved meta to footer so graphs can be higher and reduce clutter
0.1.5 2013-04-12 added graphs to visualize cache state, please report any browser/style bugs
@DzikuVx
DzikuVx / gist:3557a71e508c4a555d55
Created February 2, 2015 19:45
ATtiny watchdog
//****************************************************************
// 0=16ms, 1=32ms,2=64ms,3=128ms,4=250ms,5=500ms
// 6=1 sec,7=2 sec, 8=4 sec, 9= 8sec
void setup_watchdog(int ii) {
byte bb;
int ww;
if (ii > 9 ) ii=9;
bb=ii & 7;
if (ii > 7) bb|= (1<<5);
void enterSleep(void) {
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
sleep_enable();
sleep_mode();
sleep_disable();
}
import RPi.GPIO as GPIO
import time
def main():
# GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.OUT)
GPIO.output(18, GPIO.HIGH)
time.sleep(5);
@Override
public void onResume() {
super.onResume();
Tracker t = ((PogodaApplication) getApplication()).getTracker();
t.setScreenName("ForecastActivity");
t.send(new HitBuilders.AppViewBuilder().build());
}
<application
android:logo="@drawable/ab_icon"
android:label="@string/app_name"
android:name=".PogodaApplication"
android:icon="@drawable/ic_launcher">
package pl.spychalski.WeatherStation;
import android.app.Application;
import com.google.android.gms.analytics.GoogleAnalytics;
import com.google.android.gms.analytics.Tracker;
public class PogodaApplication extends Application {
private Tracker appTracker = null;