This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define BAUD 9600 | |
#define MYUBRR F_CPU/16/BAUD-1 | |
void USART_Init(unsigned int ubrr) | |
{ | |
/*Set baud rate */ | |
UBRR0H = (unsigned char)(ubrr>>8); | |
UBRR0L = (unsigned char)ubrr; | |
/*Enable receiver and transmitter */ | |
UCSR0B = (1<<RXEN0)|(1<<TXEN0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################################ | |
# showdata.py | |
# | |
# Display analog data from Arduino using Python (matplotlib) | |
# | |
# electronut.in | |
# | |
################################################################################ | |
import sys, serial |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// analog-plot | |
// | |
// Read analog values from A0 and A1 and print them to serial port. | |
// | |
// electronut.in | |
#include "Arduino.h" | |
void setup() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//********************************************************************** | |
// | |
// Putting the ATmega168 into Power Save mode, and then waking it | |
// with a pin-change interrupt. | |
// | |
// electronut.in | |
//********************************************************************** | |
/* | |
build commands on OS X with CrossPack: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// HC-SR04-test.ino | |
// | |
// Get distance information from Ultrasonic Ranging Module HC-SR04 and | |
// send it via serial port. | |
// | |
// electronut.in | |
#include "Arduino.h" | |
int pinTrigger = 2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// A simple program for the ATtiny84 that blinks an LED. | |
// | |
// electronut.in | |
// | |
#include <avr/io.h> | |
#include <util/delay.h> | |
#define F_CPU 8000000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Name: Makefile | |
# | |
# A simple program for the ATtiny84 that blinks an LED. | |
# | |
# electronut.in | |
DEVICE = attiny84 | |
CLOCK = 8000000 | |
PROGRAMMER = -c usbtiny | |
OBJECTS = main.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Serials communications (TX only) with ATtiny84 | |
// | |
// electronut.in | |
// | |
#include <avr/io.h> | |
#include <string.h> | |
#include <util/delay.h> | |
#include <avr/interrupt.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################################ | |
# showdata.py | |
# | |
# Display analog data from Arduino using Python (matplotlib) | |
# | |
# electronut.in | |
# | |
################################################################################ | |
import sys, serial |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Talking to ultrasonic sensor HC-SR04 with an ATtiny84, and | |
// sending distance data using serial communications. | |
// | |
// electronut.in | |
// | |
#include <avr/io.h> | |
#include <string.h> | |
#include <util/delay.h> |
OlderNewer