Skip to content

Instantly share code, notes, and snippets.

View izzuddin91's full-sized avatar
🎯
Focusing

izzuddin cheras izzuddin91

🎯
Focusing
View GitHub Profile
#include <Process.h>
#include <Console.h>
#include <Servo.h>
Process date;
int hours, minutes, seconds;
int lastSecond = -1;
Servo myservo;
int pos = 0;
void setup() {
int val = 0;
void setup() {
Serial.begin(9600);
// put your setup code here, to run once:
}
void loop() {
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
Most Arduinos have an on-board LED you can control. On the Uno and
Leonardo, it is attached to digital pin 13. If you're unsure what
pin the on-board LED is connected to on your Arduino model, check
the documentation at http://arduino.cc
This example code is in the public domain.
@izzuddin91
izzuddin91 / gist:54ed7d826e6b6ddba6cebaf8b252c966
Last active July 23, 2017 16:19
code for Real Time Clock model DS3231
// ADDED ON 24 JULY 2017
//connection:
//GND to GND
//VCC TO V in
//SDA to A4
//SCL to A5
// Written by John Boxall from http://tronixstuff.com
//ADDED 24 JULY 2017
//model ATA8041AB, 6 pins
int segA = 11; // top
int segB = 7; // right-top
int segF = 10; // left-top
int segD = 2; // bottom
int segE = 1; // left-bottom
//ADDED 24 JULY 2017
int segA = 11; // top
int segB = 7; // right-top
int segF = 10; // left-top
int segD = 2; // bottom
int segE = 1; // left-bottom
int segC = 4; // right-bottom
@izzuddin91
izzuddin91 / 7_segment_led.c
Created September 1, 2017 08:14
7 segment 12 pin led - ATA8041AB
int segA = 3; // top
int segB = 4; // right-top
int segC = 5; // right-bottom
int segD = 6; // bottom
int segE = 7; // left-bottom
int segF = 8; // left-top
int segG = 9; // middle
int dp = 10;
int digit1 = 14; // common cathode for digit1 (i.e. sambung A0)
@izzuddin91
izzuddin91 / 7_segment_led_read_serial.c
Last active September 1, 2017 08:25
7 segment led read data from serial
int segA = 3; // top
int segB = 4; // right-top
int segC = 5; // right-bottom
int segD = 6; // bottom
int segE = 7; // left-bottom
int segF = 8; // left-top
int segG = 9; // middle
int dp = 10;
int digit1 = 14; // common cathode for digit1 (i.e. A0)
@izzuddin91
izzuddin91 / currency.py
Last active September 1, 2017 08:32
calling currency api and send data through serial
import currencylayer
import serial
import time
exchange_rate = currencylayer.Client(access_key='eae8fe8c3b393cca980cf0252f876d5f')
a = exchange_rate.live_rates_for(currencies=['MYR'], base_currency='USD')
value = a['quotes']['USDMYR'] * 1000
ser = serial.Serial('/dev/ttyACM0',9600)
# tunggu 5 saat utk make sure ade mase utk connect ngan arduino, kalau x jadi laju sangat , x sempat nk pick up data
@izzuddin91
izzuddin91 / 7_segment_led_with_decimal.c
Created September 1, 2017 14:18
7 segment with decimal point light up at the first point
int segA = 3; // top
int segB = 4; // right-top
int segC = 5; // right-bottom
int segD = 6; // bottom
int segE = 7; // left-bottom
int segF = 8; // left-top
int segG = 9; // middle
int dp = 10;
int digit1 = 14; // common cathode for digit1 (i.e. A0)