Skip to content

Instantly share code, notes, and snippets.

View pilinux's full-sized avatar

mahir pilinux

View GitHub Profile
@pilinux
pilinux / List_Basic.py
Last active April 5, 2017 09:39
No Description
##########
# L.append(object) -> – append object to the end of list
# append() takes exactly one argument
L = [1,2,3,4,5]
L.append(2.1)
print(L)
# Output:
# [1, 2, 3, 4, 5, 2.1]
@pilinux
pilinux / pinx.c
Created March 19, 2016 12:40
Sample usage of PINx
/*
* lab7.c
*
* Author : mahir
*/
#include <avr/io.h>
int main(void)
{
@pilinux
pilinux / alert.js
Last active March 10, 2016 21:00
Javascript code snippets
window.alert("Hello World!");
@pilinux
pilinux / bitShifting.c
Created February 18, 2016 20:13
bit shifting
// ------- Preamble ------- //
#include <avr/io.h>
#include <util/delay.h> /* Time delay function */
int main(void) {
// ------- Inits ------- //
DDRB = 0b11111111; /* Port-B configured for output */
uint8_t i; /* unsigned 8-bit integer */
@pilinux
pilinux / bitOperation1.c
Created February 18, 2016 19:41
bit Operation 1
while(1){
PORTB = 0b00000001;
_delay_ms(500);
PORTB = 0b00000010;
_delay_ms(500);
PORTB = 0b00000100;
_delay_ms(500);
PORTB = 0b00001000;
_delay_ms(500);
PORTB = 0b00010000;
@pilinux
pilinux / structureAvrC
Created February 18, 2016 14:10
Structure of AVR C (blinkLED.c explanation)
[comment]
anything written on the right side of `//` notation, i.e on
lines 1, 5, 9, 12, 13, 15, 17, 18, 20, 21 and 23.
[includes]
lines 2-3, here include other important files for your present projects.
[function definitions]
lines 6-7, define global variables and other functions
or include library of a function.
@pilinux
pilinux / blinkLED.c
Created February 18, 2016 10:27
Lab 2 (AVR C)
// Preamble
#include <avr/io.h>
#include <util/delay.h> /* Time delay function */
// Function definitions
#define LED_DDR DDRB
#define LED_PORT PORTB
//main function
int main(void)
@pilinux
pilinux / Makefile
Created February 13, 2016 21:41
Common Makefile for all avr C projects
##########------------------------------------------------------##########
########## Project-specific Details ##########
########## Check these every time you start a new project ##########
########## or when you change your MCU or USB PORT ##########
##########------------------------------------------------------##########
MCU = atmega8 ## Name of your microcontroller device.
F_CPU = 8000000UL ## Frequency
BAUD = 19200 ## BAUD rate
PORT = /dev/ttyUSB0 ## USB PORT of your computer
@pilinux
pilinux / Usage: avrdude
Created February 13, 2016 19:38
Usage: avrdude output on Ubuntu OS
mahir@ubuntu:~$ avrdude
Usage: avrdude [options]
Options:
-p <partno> Required. Specify AVR device.
-b <baudrate> Override RS-232 baud rate.
-B <bitclock> Specify JTAG/STK500v2 bit clock period (us).
-C <config-file> Specify location of configuration file.
-c <programmer> Specify programmer type.
-D Disable auto erase for flash memory
-i <delay> ISP Clock Delay [in microseconds]
@pilinux
pilinux / lab1.c
Created February 13, 2016 10:55
AVR C Lab 1
/*
* lab1.c
*
* Created: 12/23/2015 6:18:56 PM
* Author : mahir
*/
#include <avr/io.h>