Can't get to work Capacitive Sensing Library into attiny 2313

Hi this is my first post be nice :stuck_out_tongue:

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 :stuck_out_tongue: and thx for the help :smiley:

arduino version 1.0 (0.22?)

What tiny core are you using? In all probability this will not work on the 2313 since the memory is so limited. Just using the Serial object on the 2313 takes at least half of the available memory. The 4313 may have a better chance.

Hi fenix8k, Can you compile anything for the ATtiny2313? Try the '01.Basics/BareMinimum' example, if this fails then it's probably something to do with the board configuration you use. I also notice from your error report (C:\arduino-0022\arduino-0022\arduino-1.0) you seem to have Arduino1.0 installed in the Arduino0.22 install. Did you copy the relevant ATtiny2313 board descriptions to the right places if you updated from one to the other? I installed latest ATtiny bits from here http://code.google.com/p/arduino-tiny/downloads/list and when trying to compile get memory error

Binary sketch size: 4,016 bytes (of a 2,048 byte maximum) processing.app.debug.RunnerException: Sketch too big; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing it. at processing.app.Sketch.size(Sketch.java:1693) at processing.app.Sketch.build(Sketch.java:1626) at processing.app.Sketch.build(Sketch.java:1602) at processing.app.Editor$DefaultRunHandler.run(Editor.java:1863) at java.lang.Thread.run(Thread.java:619)

so it will never run as is, even if you remove the Serial code.