Hi this is my first post be nice
I whant to make a Capacitive touch buttom here is my code.
#include <CapSense.h>
CapSense cs_4_6 = CapSense(4,6); // 10M resistor between pins 4 & 6, pin 6 is sensor pin, add a wire and or foil
CapSense cs_4_8 = CapSense(4,8); // 10M resistor between pins 4 & 8, pin 8 is sensor pin, add a wire and or foil
int check_h = 0;
int check_l = 0;
int pwm_count = 0;
int ledPin = 12;
int digitalPinToBitMask = 0;
void setup()
{
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}
void loop()
{
long total2 = cs_4_6.capSense(5);
long total3 = cs_4_8.capSense(5);
check_h = total2;
check_l = total3;
Serial.print("Amarillo: ");
Serial.print(total2);
Serial.print("\t");
Serial.print("Blanco: ");
Serial.print(total3);
Serial.print("\t");
Serial.print("PWM: ");
Serial.println(pwm_count);
if (check_h >= 9) {
if (pwm_count <= 249){
pwm_count = pwm_count + 3;
analogWrite(ledPin, pwm_count);
}
}
else if (check_l >= 9) {
if (pwm_count >= 3){
pwm_count = pwm_count - 3;
analogWrite(ledPin, pwm_count);
}
}
}
All work great when i upload to arduino mega but when i try to compile it to upload in a AtTinny 2313 i get this error code
C:\arduino-0022\arduino-0022\arduino-1.0\libraries\CapSense4\CapSense.cpp: In constructor 'CapSense::CapSense(uint8_t, uint8_t)':
C:\arduino-0022\arduino-0022\arduino-1.0\libraries\CapSense4\CapSense.cpp:43: error: 'digitalPinToBitMask' was not declared in this scope
C:\arduino-0022\arduino-0022\arduino-1.0\libraries\CapSense4\CapSense.cpp:44: error: 'digitalPinToPort' was not declared in this scope
C:\arduino-0022\arduino-0022\arduino-1.0\libraries\CapSense4\CapSense.cpp:45: error: 'portModeRegister' was not declared in this scope
C:\arduino-0022\arduino-0022\arduino-1.0\libraries\CapSense4\CapSense.cpp:46: error: 'portOutputRegister' was not declared in this scope
C:\arduino-0022\arduino-0022\arduino-1.0\libraries\CapSense4\CapSense.cpp:51: error: 'portInputRegister' was not declared in this scope
i don t knaw what to do if someone can help me, i be looking for the internet like 6 hours and can t get it to work or find another way to make a Capacitive touch buttom.
if this is not the correct forum to post this plz move the post sry and thx for the help
arduino version 1.0 (0.22?)