Show Posts
Pages: 1 ... 33 34 [35] 36 37 ... 71
511  Using Arduino / Microcontrollers / Re: Code not working with ATTINY 85 on: March 03, 2013, 10:13:43 am
One thing that could make it
Quote
not work properly
is the timing. The bounce library use millis(), and if you choose
for example the board: Attiny85@8MHZ without setting the right fuses, the timing will be off by a factor 8.

The factory default is 1MHz, so unless you have set the fuses yourself you should choose Attiny85@1MHZ


If you want to run 8MHz, do this:

Select Board -> Attiny85@8MHZ
select Programmer -> Arduino as ISP (or watever programmer you are using)
Select ->Burn bootloader

Quote
I'm not sure that all the code is supported by the attiny85

It is
512  Using Arduino / Microcontrollers / Re: SoftwareSerial with ATTiny84 using ATtiny library on: March 01, 2013, 07:38:55 am



Quote
ok this is where I am confused. I have the capacitive sensor hooked up to the attiny not the arduino

So do I   smiley-grin

Quote
nor did I know it even had it.

It does, see the picture above

Quote
you say "using 0 and 1 you are interferring with MISO" I don't see how that will interfere with MISO on attiny...?

Look at the picture PB1 (or 1) is MISO used by TinyISP to communicate with your Arduino

Quote
I have capacitive sensor on 0 and 1 of attiny

Again 1 is MISO

Quote
and reading serial from attiny on PB3 (I thought this was default, I have always used this and it used to work fine)

No, the default is PB1 when you are using TinyISP.


If you use TinyDebugSerial, the default is PB3
513  Using Arduino / Microcontrollers / Re: SoftwareSerial with ATTiny84 using ATtiny library on: February 28, 2013, 08:48:40 am
I am confused too.
I think it would be a good idea if you describe your project in more detail. It is unclear how many and which pins you are expecting to use and for what purpose.

Just to be clear that we are talking about the same:

The Capacitive Sensing Library ned a sense and receive pin
http://playground.arduino.cc//Main/CapacitiveSensor?from=Main.CapSense

If you are using TinyISP and knockbang , the serial output form attiny is pin PB1 (physical pin 6) connected to pin pin 12 on the UNO,
This is also the reason why you should not use this pin as sense pin, as I tryed to explain

That leaves you with 2 pins (three if you use the reset pin)



514  Using Arduino / Displays / Re: shift register to 7 segment on: February 28, 2013, 07:41:20 am
Try a google search, one of many results

http://arduino.cc/forum/index.php?topic=138482.15
515  Using Arduino / Project Guidance / Re: Controller for rc flight models like helicopters, quadcopters and tilt-rotors on: February 27, 2013, 09:04:27 am
You can find a lot of design tips here:


http://www.rcgroups.com/vtols-360/
516  Using Arduino / Microcontrollers / Re: SoftwareSerial with ATTiny84 using ATtiny library on: February 27, 2013, 06:56:00 am
Ohh, my copy/paste technique was bad.

What I really meant was; Try moving the sense pins to PB3 and PB4.

Code:
CapacitiveSensor cs_4_2 = CapacitiveSensor(PB3,PB4);   

If you are using 0 and 1 you are interferring with MISO, which is used by KnockBang, and gives the weird results and errors.

I tried your sketch wirth this change and the output is OK.
517  Using Arduino / Microcontrollers / Re: attiny IR communication library on: February 27, 2013, 06:16:13 am
Take a look at this:

http://ubiyubix.wordpress.com/2012/05/05/porting-the-arduino-irremote-library-to-the-attiny4313/

and

http://nathan.chantrell.net/20121014/tinypcremote-an-attiny85-based-infrared-pc-remote-control/
518  Using Arduino / Microcontrollers / Re: SoftwareSerial with ATTiny84 using ATtiny library on: February 26, 2013, 02:48:09 pm
Hmm, you are using the MOSI and MISO lines (0 and 1) as you sense pins.

Code:
CapacitiveSensor cs_4_2 = CapacitiveSensor(1,0);   

Try this instead, works for me (I think, atleast I don't get knock bang errors)

Code:
CapacitiveSensor cs_4_2 = CapacitiveSensor(1,0);   


519  Using Arduino / Microcontrollers / Re: SoftwareSerial with ATTiny84 using ATtiny library on: February 26, 2013, 06:34:07 am
hilukasz
One thing to try:
Ensure that the MISO connection wire is as short (and fat) as possible:

http://arduino.cc/forum/index.php/topic,123388.msg1029246.html#msg1029246
(reply #74)

Quote
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85

This is jusr a warning, just ignore it.

520  Using Arduino / Project Guidance / Re: Analog Comparator Interrupt on: February 25, 2013, 02:06:55 pm
In the datasheet for 1280 it is page 271 and a couple of pages more

page 272 for example:

Quote
• Bits 1, 0 – ACIS1, ACIS0: Analog Comparator Interrupt Mode Select
These bits determine which comparator events that trigger the Analog Comparator interrupt.
The different settings are shown in Table 121.
When changing the ACIS1/ACIS0 bits, the Analog Comparator Interrupt must be disabled
by clearing its Interrupt Enable bit in the ACSR Register. Otherwise an interrupt
can occur when the bits are changed.
Table 121. ACIS1/ACIS0 Settings
521  Using Arduino / Project Guidance / Re: Analog Comparator Interrupt on: February 25, 2013, 10:47:38 am
Ok, I was just looking in the 328 datasheet, I think the only difference will be the name of the Interrupt vector name:

ANALOG_COMP_vect
522  Using Arduino / Project Guidance / Re: Analog Comparator Interrupt on: February 25, 2013, 09:25:26 am
There is no reason to use  assembler.
In my test code below, I set the relevant bits according to the datasheet

Although this is for Attiny2313, I think you could adopt it for the 1280

It is more or less the code I posted earlier http://kalshagar.wikispaces.com/attiny2313

Code:

#include <avr/interrupt.h>
#include <TinyDebugKnockBang.h>
  int a=0;
  static volatile uint8_t capture;
  static volatile uint8_t flag;
  const uint8_t led = 13;
 
//Interrupt code of the comparator
// NB : you need to stabilize the power rail with a capacitor (otherwise you'll have ripples and misreading). With AIN1=Comp-=0v a 200uF is fine.
ISR(ANA_COMP_vect) {
 
    //with this test, ensure that indeed the interrupt result is 1 = V(AIN0) > V(AIN1)
    //(double check ?)
    if ( (ACSR & (1 << ACO))== 0 ) {
        flag=true;
        }
      else
      {
      flag=false;
      }
}
 

void setup() {
    //factory settings is to divide internal clock 8MHz by 8.
    //don't, and just run at 8 MHz (set the clock divider to 1 so no effect)
     Debug.begin(250000);
     pinMode(led,OUTPUT);   
    CLKPR = (1<<CLKPCE);
    CLKPR = 0; // Divide by 1
 
    PORTB &= ~(1<<PB0);    // no Pull-up on PB0
 
    ACSR  |=  (1<<ACI);    // clear Analog Comparator interrupt
    ACSR  |=
        (0<<ACD)   |         // Comparator ON
        (0<<ACBG)  |         // Disconnect 1.23V reference from AIN0 (use AIN0 and AIN1 pins)
        (1<<ACIE)  |         // Comparator Interrupt enabled
        (0<<ACIC)  |         // input capture disabled
        (0<<ACIS1) |         // set interrupt bit on rising edge
        (0<<ACIS0);          //    (ACIS1 and ACIS0 == 11)
   // Enable the interrupt
  ACSR = ACSR | (1 << ACIE);
 
    sei();                 // enable global interrupts
 
 
}
 
   void loop() {/*all the job is done in the interrupt */
     
    //    Debug.println(flag);
       if (flag==true){
       digitalWrite(led,HIGH);
       
       }
      if (flag==false){
       digitalWrite(led,LOW);
       }

    }
523  Using Arduino / Project Guidance / Re: Analog Comparator Interrupt on: February 25, 2013, 06:04:17 am
As an inspiration, here how you coul set up the comparator on a Attiny2313:

http://kalshagar.wikispaces.com/attiny2313
524  Using Arduino / Microcontrollers / Re: no serial output on "Arduino MICRO". on: February 24, 2013, 03:25:51 pm
This one?

http://arduino.cc/en/Guide/ArduinoLeonardoMicro
525  Using Arduino / Microcontrollers / Re: SoftwareSerial on ATtiny: works on Uno, but not on the ATtiny85 on: February 23, 2013, 01:24:17 pm
You could try this fix for sketches > 4.000 bytes:

https://github.com/TCWORLD/ATTinyCore/tree/master/PCREL%20Patch%20for%20GCC
Pages: 1 ... 33 34 [35] 36 37 ... 71