¿ªÔÆÌåÓý

About ATiny85 code


 

Hi Ashhar and all,

What does it mean this part of the code of the ATtiny85, I don't get it:

--
? if(flag == 1){
??? digitalWrite(5, LOW);
??? flag = 0;
? }
? else {
??? digitalWrite(5, HIGH);
??? flag = 1;
? }
--

The example from Nicholas Zambetti does not have this:




Cheers,
Rafael


 

Ah,? a good spot. I wanted to check how fast the adc works. If you see, the pin 5 is being flipped on each iteration of the loop. So, I connected the pin5 to an oscilloscope to measure the time periods.
It is cruft. It needs to be removed.
- f

On Mon, Apr 17, 2023, 12:11 AM Rafael Diniz <rafael@...> wrote:
Hi Ashhar and all,

What does it mean this part of the code of the ATtiny85, I don't get it:

--
?? if(flag == 1){
???? digitalWrite(5, LOW);
???? flag = 0;
?? }
?? else {
???? digitalWrite(5, HIGH);
???? flag = 1;
?? }
--

The example from Nicholas Zambetti does not have this:




Cheers,
Rafael







 

Thanks Ashhar, there is what I thought. Btw, which "burner" do you use to write the firmware to the ATTiny85?

Rafael

On 4/16/23 22:09, Ashhar Farhan wrote:
Ah,? a good spot. I wanted to check how fast the adc works. If you see, the pin 5 is being flipped on each iteration of the loop. So, I connected the pin5 to an oscilloscope to measure the time periods.
It is cruft. It needs to be removed.
- f

On Mon, Apr 17, 2023, 12:11 AM Rafael Diniz <rafael@...> wrote:

Hi Ashhar and all,

What does it mean this part of the code of the ATtiny85, I don't
get it:

--
?? if(flag == 1){
???? digitalWrite(5, LOW);
???? flag = 0;
?? }
?? else {
???? digitalWrite(5, HIGH);
???? flag = 1;
?? }
--

The example from Nicholas Zambetti does not have this:




Cheers,
Rafael







 

I built one with an Arduino nano, a 10uf cap and two resistors. Not sure where I saw the circuit diagram.
- f

On Mon, Apr 17, 2023, 1:57 PM Rafael Diniz <rafael@...> wrote:
Thanks Ashhar, there is what I thought. Btw, which "burner" do you use
to write the firmware to the ATTiny85?

Rafael

On 4/16/23 22:09, Ashhar Farhan wrote:
> Ah,? a good spot. I wanted to check how fast the adc works. If you
> see, the pin 5 is being flipped on each iteration of the loop. So, I
> connected the pin5 to an oscilloscope to measure the time periods.
> It is cruft. It needs to be removed.
> - f
>
> On Mon, Apr 17, 2023, 12:11 AM Rafael Diniz <rafael@...>
> wrote:
>
>? ? ?Hi Ashhar and all,
>
>? ? ?What does it mean this part of the code of the ATtiny85, I don't
>? ? ?get it:
>
>? ? ?--
>? ? ??? if(flag == 1){
>? ? ????? digitalWrite(5, LOW);
>? ? ????? flag = 0;
>? ? ??? }
>? ? ??? else {
>? ? ????? digitalWrite(5, HIGH);
>? ? ????? flag = 1;
>? ? ??? }
>? ? ?--
>
>? ? ?The example from Nicholas Zambetti does not have this:
>
>? ? ?
>
>
>? ? ?Cheers,
>? ? ?Rafael
>
>
>
>
>
>
>






 

No problem, there are also "off-the-shelf" ones. I'll choose one and test.

tks!

On 4/17/23 11:29, Ashhar Farhan wrote:
I built one with an Arduino nano, a 10uf cap and two resistors. Not sure where I saw the circuit diagram.
- f

On Mon, Apr 17, 2023, 1:57 PM Rafael Diniz <rafael@...> wrote:

Thanks Ashhar, there is what I thought. Btw, which "burner" do you
use
to write the firmware to the ATTiny85?

Rafael

On 4/16/23 22:09, Ashhar Farhan wrote:
> Ah,? a good spot. I wanted to check how fast the adc works. If you
> see, the pin 5 is being flipped on each iteration of the loop.
So, I
> connected the pin5 to an oscilloscope to measure the time periods.
> It is cruft. It needs to be removed.
> - f
>
> On Mon, Apr 17, 2023, 12:11 AM Rafael Diniz
<rafael@...>
> wrote:
>
>? ? ?Hi Ashhar and all,
>
>? ? ?What does it mean this part of the code of the ATtiny85, I don't
>? ? ?get it:
>
>? ? ?--
>? ? ??? if(flag == 1){
>? ? ????? digitalWrite(5, LOW);
>? ? ????? flag = 0;
>? ? ??? }
>? ? ??? else {
>? ? ????? digitalWrite(5, HIGH);
>? ? ????? flag = 1;
>? ? ??? }
>? ? ?--
>
>? ? ?The example from Nicholas Zambetti does not have this:
>
>

>
>
>? ? ?Cheers,
>? ? ?Rafael
>
>
>
>
>
>
>






 

Sorry to come back to this topic again, but the pin 5 is not the I2C SDA? This LOW/HIGH changes would not create some noise in the I2C communication?

I created a PR removing such code:


Rafael

On 4/16/23 22:09, Ashhar Farhan wrote:
Ah,? a good spot. I wanted to check how fast the adc works. If you see, the pin 5 is being flipped on each iteration of the loop. So, I connected the pin5 to an oscilloscope to measure the time periods.
It is cruft. It needs to be removed.
- f

On Mon, Apr 17, 2023, 12:11 AM Rafael Diniz <rafael@...> wrote:

Hi Ashhar and all,

What does it mean this part of the code of the ATtiny85, I don't
get it:

--
?? if(flag == 1){
???? digitalWrite(5, LOW);
???? flag = 0;
?? }
?? else {
???? digitalWrite(5, HIGH);
???? flag = 1;
?? }
--

The example from Nicholas Zambetti does not have this:




Cheers,
Rafael