Programing attiny13A PulseIn error

Hello it's my first time in this forum, So i'm trying to program a attiny with Arduino Uno but i'm always getting the same error: "too few arguments to the function unit32_t pulsein( unit32_t, unit32_t, unit32_t)"

Print of the problem:

I don't know how to solve this problem(I'm a noob on Arduino).

I'm following this project:

This is my code until now:

int RXin = 2; //Reciever
int AUXout = 1; // LED's

unsigned long number;
//int signal = 0;

void setup()
{

  pinMode(RXin, INPUT);
  pinMode(AUXout, OUTPUT);
  
}

void loop()
{
  number = pulseIn(RXin, HIGH);
  
   if (number <= 983)
   {
    digitalWrite(AUXout, LOW);
   }
   
  else if (number > 1486 && number < 1496)
   {
     digitalWrite(AUXout, HIGH);
   }
   
  else if (number >= 1999 && number <= 2005)
   {
     digitalWrite(AUXout, HIGH);
     delay(1000);
     digitalWrite(AUXout, LOW);
     delay(1000);
   }
}

It appears as if the pulseIn() function wants all three parameters specified. I tried it with ATTinyCore for the ATtiny85 and it is happy with specifying just the two parameters. It may be something with whatever core you use for the ATtiny13 - just a wild guess.

Try using "number = pulseIn(RXin, HIGH, 1000000)". The third parameter, timeout, is specified in micro seconds and should normally default to 1 second.

Willem.

If the three argument one works - if you're using MicroCore, open an issue for it on github and he'll get it sorted out for the next release.

But there's no reason not to use the three-argument version, now that you know what's going on (the two-argument one just calls the three-argument one with 1000000 as the third argument)

Yes I'm using MicroCore for attiny13 and already have tried to difine the timeout argument with 1000000 but the code upload to the attiny13 but dont work

How can i open a issue in github ?

Tiag0Pint0:
How can i open a issue in github ?

First of all, you need a GitHub account. If you don't have one, they are free and very easy to sign up. GitHub is by far the most popular place to host Arduino projects (or any software project, for that matter). GitHub makes it super easy to collaborate on open source software. I think anyone who is involved in programming is going to want to have an account eventually.

The next thing to do is to find the repository where the project is stored. In this case, it's here:

Near the top of the page, you'll see a row of tabs, one of which is "Issues". Click on it.

Now you want to be sure that nobody before you has already reported the issue or submitted a fix for it. Duplicate issue reports are not helpful. The issue tracker has a handy search feature that makes this easy. The only tricky thing is that the search field comes pre-filled with the filter: "is:issue is:open", which limits the search to open issues. But you want to also search for closed issues and pull requests on the topic, so you need to be sure to delete that text from the input field before adding your search query. In this case, the obvious search term is "pulsein". After doing that search, you can see that nobody has reported this issue and so it will be very helpful for you to do so.

Now it's time to open an issue. Click the "New issue" button. Start with a short but descriptive title. Follow that with a detailed description of the issue. After you get done writing it, go back and read what you wrote, but pretend you're someone else with no special knowledge of the issue. Does it still make sense? It's really important to provide enough information in issue reports, otherwise a lot of back and forth will be required to understand it. The time the repository maintainer spends doing that could have been spent fixing the actual bug instead! Worse, a vague issue report might just end up being ignored to languish in the tracker.

Once you have a finely crafted issue report, you can click the "Submit new issue".

The final thing is to make sure to be responsive to any requests for additional information. Make sure you have your GitHub notifications configured so that you will actually know (via email, etc.) when someone comments on your issue report.

It does take a bit of effort, but submitting high quality, original bug reports is a very valuable contribution to open source software projects. As the Arduino project has proven so well, when we all work together we can create something really amazing!

Have you manually enabled micros() before trying to use pulseIn()?

Hi, Tank you for the explanation I will open a new issue.

BJHenry:
Have you manually enabled micros() before trying to use pulseIn()?

And Yes I have enabled micros() in core_settings.h file

I have discovered something if I do something like that it works:

int RXin = 2; //Recetor
int AUXout = 1; // LED

unsigned long number;
//int signal = 0;

void setup()
{

  pinMode(RXin, INPUT);
  pinMode(AUXout, OUTPUT);
  
}

void loop()
{
  number = pulseIn(RXin, HIGH, 1000000);
  
   if (number >1500)
   {
    digitalWrite(AUXout, HIGH);
   }
   else {
    digitalWrite(AUXout, LOW);
   }
}

But if I use my full code this dosen't works what can be the problem?

FULL CODE:

int RXin = 2; //Recetor
int AUXout = 1; // LED

unsigned long number;
//int signal = 0;

void setup()
{

  pinMode(RXin, INPUT);
  pinMode(AUXout, OUTPUT);
  
}

void loop()
{
  number = pulseIn(RXin, HIGH, 1000000);
  
   if (number <= 983)
   {
    digitalWrite(AUXout, LOW);
   }
   
  else if (number > 1486 && number < 1496)
   {
     digitalWrite(AUXout, HIGH);
   }
   
  else if (number >= 1999 && number <= 2005)
   {
     digitalWrite(AUXout, HIGH);
     delay(1000);
     digitalWrite(AUXout, LOW);
     delay(1000);
   }
}

I think the problem is in the if's statements.