ATtiny Capacitive Sensing and Sound
hi everyone,
i'm trying sketch working on attiny85-20pu allow me capacitive sensing chip whilst changing sound output. sketch wanted use one, amended version of paul badger's (there h file in folder too):
#include <capacitivesensor.h>
capacitivesensor cs_4_2 = capacitivesensor(4,2); // 10m resistor between pins 4 & 2, pin 2 sensor pin, add wire , or foil if desired
int speakerpin = 12;
int pitch = 0;
int ledpin = 13;
void setup()
{
serial.begin(9600);
}
void loop()
{
long start = millis();
long total1 = cs_4_2.capacitivesensor(100);
serial.print(millis() - start); // check on performance in milliseconds
serial.print("\t"); // tab character debug windown spacing
serial.println(total1); // print sensor output 1
delay(10); // arbitrary delay limit data serial port
pitch = total1/26;
tone(speakerpin, pitch);
analogwrite(ledpin, total1);
delay(10);
}
but isn't working - think read somewhere attiny's can't serial?? tried tone based sketches working aren't either....the core i'm using one: https://code.google.com/p/arduino-tiny/downloads/detail?name=arduino-tiny-0150-0020.zip
any advice ace - thanks!
i'm trying sketch working on attiny85-20pu allow me capacitive sensing chip whilst changing sound output. sketch wanted use one, amended version of paul badger's (there h file in folder too):
#include <capacitivesensor.h>
capacitivesensor cs_4_2 = capacitivesensor(4,2); // 10m resistor between pins 4 & 2, pin 2 sensor pin, add wire , or foil if desired
int speakerpin = 12;
int pitch = 0;
int ledpin = 13;
void setup()
{
serial.begin(9600);
}
void loop()
{
long start = millis();
long total1 = cs_4_2.capacitivesensor(100);
serial.print(millis() - start); // check on performance in milliseconds
serial.print("\t"); // tab character debug windown spacing
serial.println(total1); // print sensor output 1
delay(10); // arbitrary delay limit data serial port
pitch = total1/26;
tone(speakerpin, pitch);
analogwrite(ledpin, total1);
delay(10);
}
but isn't working - think read somewhere attiny's can't serial?? tried tone based sketches working aren't either....the core i'm using one: https://code.google.com/p/arduino-tiny/downloads/detail?name=arduino-tiny-0150-0020.zip
any advice ace - thanks!

attiny85 can software serial, claim works. have set fuses 8mhz , external crystal/resonator desired.
your attiny core arduino 1.5, don't use ide because if use arduino uno, mega and/or attiny recommend arduino 1.0.5 stability.
i've used tone library flawlessly library (same page, different core version arduino 1.0.5)
https://code.google.com/p/arduino-tiny/downloads/detail?name=arduino-tiny-0100-0018.zip
your attiny core arduino 1.5, don't use ide because if use arduino uno, mega and/or attiny recommend arduino 1.0.5 stability.
i've used tone library flawlessly library (same page, different core version arduino 1.0.5)
https://code.google.com/p/arduino-tiny/downloads/detail?name=arduino-tiny-0100-0018.zip
Arduino Forum > Using Arduino > Microcontrollers > ATtiny Capacitive Sensing and Sound
arduino
Comments
Post a Comment