Show Posts
Pages: 1 2 3 [4] 5 6 ... 72
46  Using Arduino / Microcontrollers / Re: Attiny85 voltage issie on: March 14, 2014, 11:06:52 am
Quote
Bearing in mine 0,1,4 I have to use as I believe they are the only ones with PWM.

That's right.
The analog pins are numbered after the ADC numbers

Analog (ADC) pins are PB2 (A1), PB4 (A2) and PB3 (A3) (physical 7,3 and 2)
so for example:

Code:
int val=analogRead(2); // Reads ADC value on pin PB4
To test your circuit and the use of the right pins you could try this simplified version

Code:
#define PIN_RED 0
#define PIN_GREEN 1
#define PIN_BLUE 4
#define PIN_TEMP 3 // analog read from ADC3 - pin PB3

void setup()
{

}

void loop()
{
  // int reading = analogRead(PIN_TEMP);
  reading=5;
  for (int r = 0; r < 256; r++) {
    analogWrite(PIN_RED, r);
    analogWrite(PIN_BLUE, r);
    analogWrite(PIN_GREEN, r);
    delay(reading);
  }
  // fade from violet to red
  for (int b = 255; b > 0; b--) {
    analogWrite(PIN_RED, b);
    analogWrite(PIN_BLUE, b);
    analogWrite(PIN_GREEN, b);
    delay(reading);
  }

}
47  Using Arduino / Microcontrollers / Re: Attiny85 voltage issie on: March 14, 2014, 09:16:01 am
I get no errors when compiling and I am not surprised.

I use this core:
https://code.google.com/p/arduino-tiny/

This code:

Code:
void setup() {
Serial.begin(9600);
}

void loop() {
Serial.println("Testing..");
}

Is how you use TinyDebugSerial on ATtiny85 (and 84/2313).
The output will be on pin PB3

@wudzi : which core are you using

Quote
Then there's a problem with your installation.

@fungus: the fact that I am not using the same core as you dosn't mean there
is a problem with my installation.
48  Using Arduino / Project Guidance / Re: Can I use Spi and ethernet simultaneously in Arduino Yun on: March 12, 2014, 02:46:04 pm
The Arduino Yun has two processors.
You can see it as a Arduino Leonardo handling the SPI, and the other chip AR9331 which handles the Ethernet communication.

So yes you can handle both
49  Using Arduino / Motors, Mechanics, and Power / Re: digital servo communication protocol on: March 11, 2014, 10:35:16 am
You could take a look at Futaba's S-Bus

http://forum.arduino.cc/index.php/topic,99708.0.html
50  Topics / Robotics / Re: PID to control robot move in straight line!!!! urgent please on: March 11, 2014, 05:39:50 am
solderspot
Thank you for your link and blogpost,
well written and understandable for a PID beginner like me
51  Using Arduino / Microcontrollers / Re: Arduino Uno ISP and ATTINY2313 LED not blinking on: March 09, 2014, 03:33:48 pm
Quote
But the led on Pin 13 (PB1) of ATTINY2313 is not blinking

As mentioned in the instructions : pin 13 is PB4  or physical pin 16
52  Products / Arduino Yún / Re: Yun suddenly will not upload sketches on: March 04, 2014, 06:00:45 am
Thisn is what I did

http://forum.arduino.cc/index.php?topic=189570.0
53  Using Arduino / Installation & Troubleshooting / Re: Yun suddenly will not upload sketches on: March 04, 2014, 05:57:04 am
Quote
I'm not sure what "Arduino as ISP" means
It means you use an Arduino withe the sketch ArduinoISP ,as a programmer,

Take a look at this.

http://www.gammon.com.au/forum/?id=11643
54  Using Arduino / Installation & Troubleshooting / Re: Yun suddenly will not upload sketches on: March 03, 2014, 03:04:22 pm
Did  you try to upload a sketch via LAN ?

I once had the  problem that the bootloader disappeared, which gave the same symptons as you describe.
I reburned the bootloader using Arduino as ISP.

But i think there might be easyer solutions, I think it would be better asking in the Yun subforum
55  Using Arduino / LEDs and Multiplexing / Re: 38khz IR Signal using ATTINY85 on: March 03, 2014, 08:51:53 am
Quote
When you say 0 it is PB0 (physical pin 5) and 3 means PB3 (physical pin 2) right. S

Yes that was what I meant.

Actually this might be easyer. This sketch will output on pin 0 (PB0), so you just connect your IR-led like the drawing.

Code:
//Attiny85 IR-test
//Attiny85 , running @ 8MHZ
// ATMEL ATTINY45 / ARDUINO
//
//                           +-\/-+
//  Ain0       (D  5)  PB5  1|    |8   VCC
//  Ain3       (D  3)  PB3  2|    |7   PB2  (D  2)  INT0  Ain1
//  Ain2       (D  4)  PB4  3|    |6   PB1  (D  1)        pwm1
//                     GND  4|    |5   PB0  (D  0)        pwm0
//                           +----+
void setup(){
  DDRB |= (1<<PB0); //Set pin PB0 as output
  TCNT0 = 0;
  TCCR0A=0;
  TCCR0B=0;

  TCCR0A |=(1<<COM0A0); //Timer0 in toggle mode Table 11-2
  TCCR0A |=(1<<WGM01); //Start timer 1 in CTC mode Table 11.5
  TCCR0B |= (1 << CS00);// Prescaler table 11.6
  OCR0A=104; //CTC Compare value
}

void loop(){
  TCCR0A &= ~(1<<COM0A0); //off
  delay(1000);
  TCCR0A |=(1<<COM0A0); //on
  delay(1000);
}
56  Using Arduino / LEDs and Multiplexing / Re: 38khz IR Signal using ATTINY85 on: March 03, 2014, 06:28:17 am
Quote
Pin 0 is the reset pin

No, take a look at the pinout

Code:
       +-\/-+
 PB5  1|    |8   VCC
 PB3  2|    |7   PB2
 PB4  3|    |6   PB1
 GND  4|    |5   PB0
       +----+

If you connect the IR diode as I suggested the output will be like the picture from my logic analyzer.

I think it would be easyer to check the output if you use a longer delay, f.ex. 1 second on/off


57  Using Arduino / LEDs and Multiplexing / Re: 38khz IR Signal using ATTINY85 on: March 02, 2014, 10:42:19 am
One way to do it is to connect your IR-diode between pin 3 and pin 0 (with a resitor in serie)
That way the diode is on only when pin 3 is LOW.
Don't expect too much precision, partly bescause you don't use a x-tal (asumption) and partly because there are some overhead in the loop.
BTW the code asumes the Attiny85 is running @ 8 MHZ.

Code:
/*
Anode (long leg connected) to 0
Cathode (short leg to 3 through resistor)
 */
void setup(){
  TCNT0 = 0;
  TCCR0A=0;
  TCCR0B=0;

  TCCR0A |=(1<<COM0A0); //Timer0 in toggle mode Table 11.2
  TCCR0A |=(1<<WGM01); //Start timer 0 in CTC mode Table 11.5
  TCCR0B |= (1 << CS00);// Prescaler Table 11.6
  OCR0A=105; //CTC Compare value
  pinMode(0,OUTPUT);
  pinMode(3,OUTPUT);
}

void loop(){
  PORTB |=_BV(3);  //off
  delayMicroseconds(500);
  PORTB &=~_BV(3);  //on
  delayMicroseconds(400);
}
58  Using Arduino / Microcontrollers / Re: DS18B20 on Attiny85 on: February 28, 2014, 10:41:24 am
Take a look at two recent threads about  DS18B20 on Attiny84/85

http://forum.arduino.cc/index.php?PHPSESSID=pj61g4bqqengv8m112nh5encg3&topic=216663.0
59  Using Arduino / Microcontrollers / Re: SoftwareSerial with ATTiny84 using ATtiny library on: February 28, 2014, 10:37:21 am
Please post your sketch
60  Using Arduino / Microcontrollers / Re: SoftwareSerial with ATTiny84 using ATtiny library on: February 28, 2014, 09:06:23 am
This is what i have in the _TinyISP_BuildOptions.h tab when using KnockBang.

Code:
//Set to 1 if using KnockBang and comment out #include <SoftwareSerial.h> in TinyISP
#define RELAY_KNOCK_BANG_ENABLED 1

//Set to 1 if using Serial Relay, and uncomment #include <SoftwareSerial.h> in TinyISP
//Transmit on Arduino is A0
#define RELAY_SERIAL_ENABLED  0

And in the TinyISP tab I comment out #include <SoftwareSerial.h>

Code:
//#include <SoftwareSerial.h>
Pages: 1 2 3 [4] 5 6 ... 72