Resistencias LDR (Light Dependent Resistor)
La resistencia es de 1 kOhm
Código:
void setup() {
Serial.begin(9600);
}
void loop() {
int j = analogRead(0);
Serial.println(j);
}
Fuente 1: http://www.varesano.net/
Fuente 2: http://zbutton.wordpress.com/2010/06/08/medidor-de-luz-en-cocoa-usando-arduino/
Error al compilar en ATtiny85 - relocation truncated to fit: R_AVR_13_PCREL
Si da este error:
c:/crusso/arduino/arduino-1.0.1/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn45.o:(.init9+0x2): relocation truncated to fit: R_AVR_13_PCREL against symbol `exit' defined in .fini9 section in c:/crusso/arduino/arduino-1.0.1/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/avr25\libgcc.a(_exit.o)
core.a(WString.cpp.o): In function `String::getBuffer(unsigned int)':
/WString.h:102: relocation truncated to fit: R_AVR_13_PCREL against symbol `malloc' defined in .text section in c:/crusso/arduino/arduino-1.0.1/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25\libc.a(malloc.o)
core.a(WString.cpp.o): In function `String::operator=(String const&)':
C:\crusso\arduino\arduino-1.0.5\hardware\tiny\cores\tiny/WString.cpp:127: relocation truncated to fit: R_AVR_13_PCREL against symbol `free' defined in .text section in c:/crusso/arduino/arduino-1.0.1/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25\libc.a(malloc.o)
c:/crusso/arduino/arduino-1.0.1/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn45.o:(.init9+0x2): relocation truncated to fit: R_AVR_13_PCREL against symbol `exit' defined in .fini9 section in c:/crusso/arduino/arduino-1.0.1/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/avr25\libgcc.a(_exit.o)
core.a(WString.cpp.o): In function `String::getBuffer(unsigned int)':
/WString.h:102: relocation truncated to fit: R_AVR_13_PCREL against symbol `malloc' defined in .text section in c:/crusso/arduino/arduino-1.0.1/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25\libc.a(malloc.o)
core.a(WString.cpp.o): In function `String::operator=(String const&)':
C:\crusso\arduino\arduino-1.0.5\hardware\tiny\cores\tiny/WString.cpp:127: relocation truncated to fit: R_AVR_13_PCREL against symbol `free' defined in .text section in c:/crusso/arduino/arduino-1.0.1/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25\libc.a(malloc.o)
bajar el archivo ld.exe de esta ubicación:
en la carpeta:
C:\crusso\arduino\arduino-1.0.5\hardware\tools\avr\avr\bin
Control remoto con Android y módulo bluetooth de Arduino
Los íconos los conseguí en:
http://www.iconsdb.com/soylent-red-icons/
Códigos TV SONY Bravia
POWER - 2704
1 - 16
2 - 2064
3 - 1040
4 - 3088
5 - 528
6 - 2574
7 - 1552
8 - 3600
9 - 272
0 - 2320
VOL+ - 1168
VOL- - 3216
CH+ - 144
CH- - 2192
MUTING - 656
JUMP - 3536
Codigo 1 - Simple para prender la TV Sony
#includeIRsend irsend; int codeType = -1; // The type of code unsigned long codeValue; // The code value if not raw unsigned int rawCodes[RAWBUF]; // The durations if raw int codeLen; // The length of the code int toggle = 0; // The RC5/6 toggle state void setup() { Serial.begin(9600); } void sendCode(int repeat) { if (codeType == NEC) { if (repeat) { irsend.sendNEC(REPEAT, codeLen); Serial.println("Sent NEC repeat"); } else { irsend.sendNEC(codeValue, codeLen); Serial.print("Sent NEC "); Serial.println(codeValue, HEX); } } else if (codeType == SONY) { irsend.sendSony(codeValue, codeLen); Serial.print("Sent Sony "); Serial.println(codeValue, HEX); } else if (codeType == RC5 || codeType == RC6) { if (!repeat) { // Flip the toggle bit for a new button press toggle = 1 - toggle; } // Put the toggle bit into the code to send codeValue = codeValue & ~(1 << (codeLen - 1)); codeValue = codeValue | (toggle << (codeLen - 1)); if (codeType == RC5) { Serial.print("Sent RC5 "); Serial.println(codeValue, HEX); irsend.sendRC5(codeValue, codeLen); } else { irsend.sendRC6(codeValue, codeLen); Serial.print("Sent RC6 "); Serial.println(codeValue, HEX); } } else if (codeType == UNKNOWN /* i.e. raw */) { // Assume 38 KHz irsend.sendRaw(rawCodes, codeLen, 38); Serial.println("Sent raw"); } } void loop() { codeType = SONY; codeValue = 2704; codeLen = 12; for (int i=0; i < 5; i++) { sendCode(false); delay(50); // Wait a bit between retransmissions } for(;;); } Codigo 2 Este código es el que viene de ejemplo, pero modificado para que reciba un código y lo reenvíe a luego de 8 segundos. /* * IRrecord: record and play back IR signals as a minimal * An IR detector/demodulator must be connected to the input RECV_PIN. * An IR LED must be connected to the output PWM pin 3. * A button must be connected to the input BUTTON_PIN; this is the * send button. * A visible LED can be connected to STATUS_PIN to provide status. * * The logic is: * If the button is pressed, send the IR code. * If an IR code is received, record it. * * Version 0.11 September, 2009 * Copyright 2009 Ken Shirriff * http://arcfn.com */ #include int RECV_PIN = 11; int BUTTON_PIN = 12; int STATUS_PIN = 13; IRrecv irrecv(RECV_PIN); IRsend irsend; decode_results results; void setup() { Serial.begin(9600); irrecv.enableIRIn(); // Start the receiver pinMode(BUTTON_PIN, INPUT); pinMode(STATUS_PIN, OUTPUT); } // Storage for the recorded code int codeType = -1; // The type of code unsigned long codeValue; // The code value if not raw unsigned int rawCodes[RAWBUF]; // The durations if raw int codeLen; // The length of the code int toggle = 0; // The RC5/6 toggle state // Stores the code for later playback // Most of this code is just logging void storeCode(decode_results *results) { codeType = results->decode_type; int count = results->rawlen; if (codeType == UNKNOWN) { Serial.println("Received unknown code, saving as raw"); codeLen = results->rawlen - 1; // To store raw codes: // Drop first value (gap) // Convert from ticks to microseconds // Tweak marks shorter, and spaces longer to cancel out IR receiver distortion for (int i = 1; i <= codeLen; i++) { if (i % 2) { // Mark rawCodes[i - 1] = results->rawbuf[i]*USECPERTICK - MARK_EXCESS; Serial.print(" m"); } else { // Space rawCodes[i - 1] = results->rawbuf[i]*USECPERTICK + MARK_EXCESS; Serial.print(" s"); } Serial.print(rawCodes[i - 1], DEC); } Serial.println(""); } else { if (codeType == NEC) { Serial.print("Received NEC: "); if (results->value == REPEAT) { // Don't record a NEC repeat value as that's useless. Serial.println("repeat; ignoring."); return; } } else if (codeType == SONY) { Serial.print("Received SONY: "); } else if (codeType == RC5) { Serial.print("Received RC5: "); } else if (codeType == RC6) { Serial.print("Received RC6: "); } else { Serial.print("Unexpected codeType "); Serial.print(codeType, DEC); Serial.println(""); } Serial.println(results->value, HEX); codeValue = results->value; codeLen = results->bits; } } void sendCode(int repeat) { if (codeType == NEC) { if (repeat) { irsend.sendNEC(REPEAT, codeLen); Serial.println("Sent NEC repeat"); } else { irsend.sendNEC(codeValue, codeLen); Serial.print("Sent NEC "); Serial.println(codeValue, HEX); } } else if (codeType == SONY) { irsend.sendSony(codeValue, codeLen); Serial.print("Sent Sony "); Serial.println(codeValue, HEX); } else if (codeType == RC5 || codeType == RC6) { if (!repeat) { // Flip the toggle bit for a new button press toggle = 1 - toggle; } // Put the toggle bit into the code to send codeValue = codeValue & ~(1 << (codeLen - 1)); codeValue = codeValue | (toggle << (codeLen - 1)); if (codeType == RC5) { Serial.print("Sent RC5 "); Serial.println(codeValue, HEX); irsend.sendRC5(codeValue, codeLen); } else { irsend.sendRC6(codeValue, codeLen); Serial.print("Sent RC6 "); Serial.println(codeValue, HEX); } } else if (codeType == UNKNOWN /* i.e. raw */) { // Assume 38 KHz irsend.sendRaw(rawCodes, codeLen, 38); Serial.println("Sent raw"); } } int lastButtonState; void loop() { // If button pressed, send the code. /* int buttonState = digitalRead(BUTTON_PIN); if (lastButtonState == HIGH && buttonState == LOW) { Serial.println("Released"); irrecv.enableIRIn(); // Re-enable receiver } */ if (Serial.available()) { char c = Serial.read(); if (c == 's') { Serial.println("Pressed, sending"); digitalWrite(STATUS_PIN, HIGH); sendCode(false); digitalWrite(STATUS_PIN, LOW); delay(50); // Wait a bit between retransmissions irrecv.enableIRIn(); // Re-enable receiver } } else if (irrecv.decode(&results)) { Serial.println("recibiendo..."); digitalWrite(STATUS_PIN, HIGH); storeCode(&results); irrecv.resume(); // resume receiver digitalWrite(STATUS_PIN, LOW); delay(8000); for (int i=0; i<5; i++) { digitalWrite(STATUS_PIN, HIGH); sendCode(false); digitalWrite(STATUS_PIN, LOW); delay(50); // Wait a bit between retransmissions } irrecv.enableIRIn(); } }
Controlar servo sin Servo library
int servo1 = 9; //tiene que ser PWM
int myAngle1;
int pulseWidth1;
void servoPulse1 (int servo1, int myAngle1) {
pulseWidth1 = (myAngle1 * 11) + 500; // Converts angle to microseconds
digitalWrite(servo1, HIGH); // Set servo high (turns it on)
delayMicroseconds(pulseWidth1); // Wait a very very small amount
digitalWrite(servo1, LOW); // Set servo low (turns it off)
delay(20); // Typical Refresh cycle of servo (20 ms)
}
void setup() {
pinMode(servo1, OUTPUT);
}
void loop() {
servoPulse1(servo1, 60);
delay(1000);
servoPulse1(servo1, 90);
delay(1000);
}
Detectar multiples taps en piezo con Arduino
Este codigo es miiiiiiiooooooo!!
Resistencia de 1M Ohm entre analog 0 y ground
Piezo entre analog 0 y ground
Resistencia de 1M Ohm entre analog 0 y ground
Piezo entre analog 0 y ground
Control remoto universal con IRremote
Los íconos los conseguí en:
http://www.iconsdb.com/soylent-red-icons/
Códigos TV SONY Bravia
POWER - 2704
1 - 16
2 - 2064
3 - 1040
4 - 3088
5 - 528
6 - 2574
7 - 1552
8 - 3600
9 - 272
0 - 2320
VOL+ - 1168
VOL- - 3216
CH+ - 144
CH- - 2192
MUTING - 656
JUMP - 3536
Codigo 1 - Simple para prender la TV Sony
#includeIRsend irsend; int codeType = -1; // The type of code unsigned long codeValue; // The code value if not raw unsigned int rawCodes[RAWBUF]; // The durations if raw int codeLen; // The length of the code int toggle = 0; // The RC5/6 toggle state void setup() { Serial.begin(9600); } void sendCode(int repeat) { if (codeType == NEC) { if (repeat) { irsend.sendNEC(REPEAT, codeLen); Serial.println("Sent NEC repeat"); } else { irsend.sendNEC(codeValue, codeLen); Serial.print("Sent NEC "); Serial.println(codeValue, HEX); } } else if (codeType == SONY) { irsend.sendSony(codeValue, codeLen); Serial.print("Sent Sony "); Serial.println(codeValue, HEX); } else if (codeType == RC5 || codeType == RC6) { if (!repeat) { // Flip the toggle bit for a new button press toggle = 1 - toggle; } // Put the toggle bit into the code to send codeValue = codeValue & ~(1 << (codeLen - 1)); codeValue = codeValue | (toggle << (codeLen - 1)); if (codeType == RC5) { Serial.print("Sent RC5 "); Serial.println(codeValue, HEX); irsend.sendRC5(codeValue, codeLen); } else { irsend.sendRC6(codeValue, codeLen); Serial.print("Sent RC6 "); Serial.println(codeValue, HEX); } } else if (codeType == UNKNOWN /* i.e. raw */) { // Assume 38 KHz irsend.sendRaw(rawCodes, codeLen, 38); Serial.println("Sent raw"); } } void loop() { codeType = SONY; codeValue = 2704; codeLen = 12; for (int i=0; i < 5; i++) { sendCode(false); delay(50); // Wait a bit between retransmissions } for(;;); } Codigo 2 Este código es el que viene de ejemplo, pero modificado para que reciba un código y lo reenvíe a luego de 8 segundos. /* * IRrecord: record and play back IR signals as a minimal * An IR detector/demodulator must be connected to the input RECV_PIN. * An IR LED must be connected to the output PWM pin 3. * A button must be connected to the input BUTTON_PIN; this is the * send button. * A visible LED can be connected to STATUS_PIN to provide status. * * The logic is: * If the button is pressed, send the IR code. * If an IR code is received, record it. * * Version 0.11 September, 2009 * Copyright 2009 Ken Shirriff * http://arcfn.com */ #include int RECV_PIN = 11; int BUTTON_PIN = 12; int STATUS_PIN = 13; IRrecv irrecv(RECV_PIN); IRsend irsend; decode_results results; void setup() { Serial.begin(9600); irrecv.enableIRIn(); // Start the receiver pinMode(BUTTON_PIN, INPUT); pinMode(STATUS_PIN, OUTPUT); } // Storage for the recorded code int codeType = -1; // The type of code unsigned long codeValue; // The code value if not raw unsigned int rawCodes[RAWBUF]; // The durations if raw int codeLen; // The length of the code int toggle = 0; // The RC5/6 toggle state // Stores the code for later playback // Most of this code is just logging void storeCode(decode_results *results) { codeType = results->decode_type; int count = results->rawlen; if (codeType == UNKNOWN) { Serial.println("Received unknown code, saving as raw"); codeLen = results->rawlen - 1; // To store raw codes: // Drop first value (gap) // Convert from ticks to microseconds // Tweak marks shorter, and spaces longer to cancel out IR receiver distortion for (int i = 1; i <= codeLen; i++) { if (i % 2) { // Mark rawCodes[i - 1] = results->rawbuf[i]*USECPERTICK - MARK_EXCESS; Serial.print(" m"); } else { // Space rawCodes[i - 1] = results->rawbuf[i]*USECPERTICK + MARK_EXCESS; Serial.print(" s"); } Serial.print(rawCodes[i - 1], DEC); } Serial.println(""); } else { if (codeType == NEC) { Serial.print("Received NEC: "); if (results->value == REPEAT) { // Don't record a NEC repeat value as that's useless. Serial.println("repeat; ignoring."); return; } } else if (codeType == SONY) { Serial.print("Received SONY: "); } else if (codeType == RC5) { Serial.print("Received RC5: "); } else if (codeType == RC6) { Serial.print("Received RC6: "); } else { Serial.print("Unexpected codeType "); Serial.print(codeType, DEC); Serial.println(""); } Serial.println(results->value, HEX); codeValue = results->value; codeLen = results->bits; } } void sendCode(int repeat) { if (codeType == NEC) { if (repeat) { irsend.sendNEC(REPEAT, codeLen); Serial.println("Sent NEC repeat"); } else { irsend.sendNEC(codeValue, codeLen); Serial.print("Sent NEC "); Serial.println(codeValue, HEX); } } else if (codeType == SONY) { irsend.sendSony(codeValue, codeLen); Serial.print("Sent Sony "); Serial.println(codeValue, HEX); } else if (codeType == RC5 || codeType == RC6) { if (!repeat) { // Flip the toggle bit for a new button press toggle = 1 - toggle; } // Put the toggle bit into the code to send codeValue = codeValue & ~(1 << (codeLen - 1)); codeValue = codeValue | (toggle << (codeLen - 1)); if (codeType == RC5) { Serial.print("Sent RC5 "); Serial.println(codeValue, HEX); irsend.sendRC5(codeValue, codeLen); } else { irsend.sendRC6(codeValue, codeLen); Serial.print("Sent RC6 "); Serial.println(codeValue, HEX); } } else if (codeType == UNKNOWN /* i.e. raw */) { // Assume 38 KHz irsend.sendRaw(rawCodes, codeLen, 38); Serial.println("Sent raw"); } } int lastButtonState; void loop() { // If button pressed, send the code. /* int buttonState = digitalRead(BUTTON_PIN); if (lastButtonState == HIGH && buttonState == LOW) { Serial.println("Released"); irrecv.enableIRIn(); // Re-enable receiver } */ if (Serial.available()) { char c = Serial.read(); if (c == 's') { Serial.println("Pressed, sending"); digitalWrite(STATUS_PIN, HIGH); sendCode(false); digitalWrite(STATUS_PIN, LOW); delay(50); // Wait a bit between retransmissions irrecv.enableIRIn(); // Re-enable receiver } } else if (irrecv.decode(&results)) { Serial.println("recibiendo..."); digitalWrite(STATUS_PIN, HIGH); storeCode(&results); irrecv.resume(); // resume receiver digitalWrite(STATUS_PIN, LOW); delay(8000); // for (int i=0; i<5; i++) { digitalWrite(STATUS_PIN, HIGH); sendCode(false); digitalWrite(STATUS_PIN, LOW); delay(50); // Wait a bit between retransmissions } irrecv.enableIRIn(); // Re-enable receiver // } }
LCD I2C con ATiny85
http://playground.arduino.cc/Code/USIi2c
Ver ejemplo Tiny85_Temp_LCD dentro de TinnyWireM
(codigo de las librerias en google drive)
https://drive.google.com/#folders/0B8buGbwpnmSkeHZCbDI2SHYzdE0
Consultar lista con linq
var v = new List<Dato>();
v.Add(new Dato(1, "carlos"));
v.Add(new Dato(2, "abc"));
var qry = from p in v
where p._ci == 2
select p;
if (qry.Count() > 0)
Console.WriteLine(qry.First()._nombre);
v.Add(new Dato(1, "carlos"));
v.Add(new Dato(2, "abc"));
var qry = from p in v
where p._ci == 2
select p;
if (qry.Count() > 0)
Console.WriteLine(qry.First()._nombre);
Receptor bluetooth con Arduino y android
Ejemplo de door lock (con codigo C# y para Android)
http://www.instructables.com/id/Easy-Bluetooth-Enabled-Door-Lock-With-Arduino-An/
00:12:08:24:01:61
Class:1f00 Bind:Bonded
Instrucciones:
http://www.instructables.com/id/Easy-Bluetooth-Enabled-Door-Lock-With-Arduino-An/
Para conocer la MAC address del dispositivo bluetooth, acceder con alguna aplicación para Android (ej, Bluetooth SPP)
Ej:
linvor (rssi:-55dBM)00:12:08:24:01:61
Class:1f00 Bind:Bonded
Instrucciones:
Features:
1) Wireless serial bluetooth port.
2) With free power adapter bottom board come with well power regulator.
User can connect 3.3 to 5VDC and connect TX and RX to your control IO (general 3.3 to 5V digital input output of MCU or arduino IO is ok, or general TLL IO)
3) Easy to connect this module with PC, just search and key "1234" passcode.
4) With white SMD LED on the adapter board, can see the Bluetooth connection status.
Step to connect:
1) Connect the wiring, power up, while the device is not connected, the bluetooth module board has a white LED flashing
2) At PC side, search bluetooth device.
3) Found name called "LINVOR" device
4) Connect it, and passcode is "1234"
5) While connection is ok, you can see the LED become always on.
6) Enjoy
Basically, user can only use 2 to 5 pin in most of the application
| PIN | NAME | FUNCTION |
| 1 | KEY | For configuration use (normally not connected) |
| 2 | VCC | 3.3 to 5V input |
| 3 | GND | Ground |
| 4 | TXD | TX transmit pin |
| 5 | RXD | RX receive pin |
| 6 | STATE | Connection status |
Industrial serial port bluetooth, Drop-in replacement for wired serial connections, transparent usage. You can use it
simply for a serial port replacement to establish connection between MCU and GPS, PC to your embedded project and etc.
Migrar mantis a nueva version de MySql
mysqldump -P 3360 -h Xmantis -uroot -ppasdfsewr234w0rd mantis > mantis.sql
Importar BD
mysql -P 3306 -h localhost -uroot -proot mantisPrueba < mantis.sql
Transformar passwords al nuevo formato
UPDATE mysql.user SET Password = OLD_PASSWORD('root')
WHERE Host = 'localhost' AND User = 'root';
FLUSH PRIVILEGES;
SET PASSWORD FOR 'root'@'localhost' = OLD_PASSWORD('root');
Tamaño de fuente en jqueryUI autocomplete
Para achicar el tamaño de fuente en autocomplete, agregar en jquery-ui-1.10.3.css la siguiente linea:
.ui-autocomplete .ui-menu-item
{ font-size:x-small;}
.ui-autocomplete .ui-menu-item
{ font-size:x-small;}
Programar ATtiny85 con Arduino
1. Programador
Para utilizar un arduino (UNO en este ejemplo) como programador del Attiny85, este es el pinout:
El capacitor que se debe usar es de 10 uF
2. Configuración del IDE de Arduino
Para version 1.8.9 de Arduino IDE:
1. File/Preferences/Additional Boards Manager URL:
https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json
2. Tools/Board/Boards Manager/Buscar attiny e instalarlo
3. Quitar el shield que tiene el socket del attiny antes del siguiente paso [ESTO ES SOLAMENTE SI SE VA A CONFIGURAR EL ARDUINO PROGRAMADOR POR PRIMERA VEZ]
4. Tools / Board / Arduino UNO
Tools / Programmer / AVRISP mkII
Abrir File/Examples/ArduinoISP
Subirlo al Arduino UNO
5. Conectar el shield
6. Tools / Board / Attiny25/45/85
Processor: Attiny85
Clock: Internal 8MHZ
Programmer: Arduino as ISP
7. Si es la primera vez que se va a usar el attiny85, hay que cambiarle el reloj a 8Mhz: para esto: Tools/Burn Bootloader
8. Subir codigo al Attiny85
Para poder utilizar la librería MANCHESTER, no sirve el del link anterior, hay que bajar el de este link:
https://drive.google.com/?authuser=0#folders/0B8buGbwpnmSkWkNIT1N3TUJmTGM
y seleccionar el que dice ATtiny85 @ 8Mhz
Fuentes:
http://hlt.media.mit.edu/?p=1706
http://tronixstuff.wordpress.com/2011/11/23/using-an-attiny-as-an-arduino/
http://www.youtube.com/watch?v=30rPt802n1k
http://hlt.media.mit.edu/?p=1695
En este caso se utilizará la versión de arduino 1.6.0
Por defecto, en la lista de boards no van a aparecer los Attiny's
Para que aparezcan hay que copiar la carpeta que está en este link (o disponible en Drive también, dentro de _ARDUINO/_BACKUP ARDUINO 1.6.0/hardware, carpeta attiny)
a la ubicación Arduino\hardware
https://github.com/damellis/attiny/archive/ide-1.6.x.zip
Luego de reiniciar el IDE, aparece un menú dentro de "Board" llamado Attiny
Elegirlo, y luego seleccionar 8Mhz en el menú Clock, luego Attiny85 en el menú Processor.
En el menú Programmer, elegir "Arduino as ISP" (el programador por defecto es AVRISP mkII)
3. Configuración del reloj del Attny85 a 8Mhz
Por defecto, los Attiny85 vienen configurados a 1Mhz.
Para pasarlos a 8Mhz:
By default, the ATtiny’s run at 1 MHz. To use the SoftwareSerial library, you need to do an extra step and configure the microcontroller to run at 8 MHz. Once you have the microcontroller connected, select “8 MHz (Internal)” from the Tools > Clock menu. (In Arduino 1.0.x, select the appropriate 8 MHz clock option from the main Tools > Board menu.) Warning: make sure you select “internal” not “external” or your microcontroller will stop working (until you connect an external clock to it). Then, run the “Burn Bootloader” command from the Tools menu. This configures the fuse bits of the microcontroller so it runs at 8 MHz. Note that the fuse bits keep their value until you explicitly change them, so you’ll only need to do this step once for each microcontroller. (Note this doesn’t actually burn a bootloader onto the board; you’ll still need to upload new programs using an external programmer.)
ATENCION!!! EL BURN BOOTLOADER SE DEBE HACER ELIGIENDO EL ATtiny85 (internal 8mhz...) y no el que dice ATtiny85 @ 8Mhz
Para utilizar un arduino (UNO en este ejemplo) como programador del Attiny85, este es el pinout:
El capacitor que se debe usar es de 10 uF
2. Configuración del IDE de Arduino
Para version 1.8.9 de Arduino IDE:
1. File/Preferences/Additional Boards Manager URL:
https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json
2. Tools/Board/Boards Manager/Buscar attiny e instalarlo
3. Quitar el shield que tiene el socket del attiny antes del siguiente paso [ESTO ES SOLAMENTE SI SE VA A CONFIGURAR EL ARDUINO PROGRAMADOR POR PRIMERA VEZ]
4. Tools / Board / Arduino UNO
Tools / Programmer / AVRISP mkII
Abrir File/Examples/ArduinoISP
Subirlo al Arduino UNO
5. Conectar el shield
6. Tools / Board / Attiny25/45/85
Processor: Attiny85
Clock: Internal 8MHZ
Programmer: Arduino as ISP
7. Si es la primera vez que se va a usar el attiny85, hay que cambiarle el reloj a 8Mhz: para esto: Tools/Burn Bootloader
8. Subir codigo al Attiny85
Para poder utilizar la librería MANCHESTER, no sirve el del link anterior, hay que bajar el de este link:
https://drive.google.com/?authuser=0#folders/0B8buGbwpnmSkWkNIT1N3TUJmTGM
y seleccionar el que dice ATtiny85 @ 8Mhz
Fuentes:
http://hlt.media.mit.edu/?p=1706
http://tronixstuff.wordpress.com/2011/11/23/using-an-attiny-as-an-arduino/
http://www.youtube.com/watch?v=30rPt802n1k
http://hlt.media.mit.edu/?p=1695
Configuring the ATtiny to run at 8 MHz (for SoftwareSerial support)
Suscribirse a:
Entradas (Atom)


