delete that

Go To Last Post
19 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

delete that

Last Edited: Mon. Jun 10, 2019 - 10:18 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Does your switch work? You’ve not enabled pullups and told us how you’ve wired the switch.

Last Edited: Sat. Dec 8, 2018 - 04:37 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, the code switch works perfectly.

 

The switch button is connected like this:

 

The red wire are connected in PB1

The black wire are connected in PB2

The white wire are connected in PB0

The red yellow are connected in GND

 

(I am using this lot of wire to be able to test with the LEDS)

 

I did not activate pullup because I did not know what it is and what it is for. Can you explain me?

 

@Edit:

In the serial monitor it is writing "hey, its changed" in loop, for ever...

Attachment(s): 

Last Edited: Sat. Dec 8, 2018 - 02:52 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

freakshow wrote:
The switch button is connected like this: The red wire are connected in D09 The black wire are connected in D10 The white wire are connected in D08 The red yellow are connected in GND

LOL -- how does that help?  Is your switch wired active-high or active-low? Is there a pulling resistor one way or the other?  Four wires for a switch? 

 

What is D08/D09/etc.?  Arduino digital pins?  What AVR pins do they correspond to?

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The switch pulls the port pin low, what pulls it high? This means your port pin ‘floats’ and has no determinable logic level so even just looking at the port pin may change its state.

For PORTB0, enable the pullup by PORTB |=1;

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Really you're right, sorry for the mess. I tried to edit to make it clearer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think I've begun to understand what you're saying. I have some resistors and 4 pin buttons here. How would I mount to test all 4 of these interrupt types?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Being an Arduino, there must be a zillion examples to connect pushbuttons and leds. Here you are doing advanced interrupts, but yet you’ve skipped the basic hardware interface.

[edit] 10 seconds of googling arduino pushbutton got this:
https://www.arduino.cc/en/tutorial/pushbutton

Google arduino led
And that should solve how to connect leds properly.

Last Edited: Sat. Dec 8, 2018 - 09:04 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

delete that

Attachment(s): 

Last Edited: Mon. Jun 10, 2019 - 10:20 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

220 ohm and 150ohm resistors?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Fine for leds, probably not so good for your pushbutton switch.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Four pin push buttons usually have pins connected together in pairs. Check it with an multimeter (on ohm or continuity setting). 

 

Jim

 

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

delete that

Last Edited: Mon. Jun 10, 2019 - 10:20 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Why on earth would you wire it like that?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Especially since i’ve given him two valid options.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

delete that

Last Edited: Mon. Jun 10, 2019 - 10:20 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

freakshow wrote:
My God, there must be a lack of understanding here or they do not understand me or I do not understand them.

Like, what is the model of this switch, with two pairs of legs tied together?

 

And why wouldn't you just connect the switch to Gnd and use the internal pullup, and work active-low?

 

Yes, external interrupts work pretty much as you summarized.  But my god, to what end?  Buttons bounce, so you don't get clean results with external interrupt.  Low-level repeats itself, and is pretty much passe since pin-change will awaken an AVR.  Any pin chan do "change" with [wait for it] pin-change.  Other mechanisms can be used for edge selection, including analog comparator and timer-as-counter.

 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

theusch wrote:
And why wouldn't you just connect the switch to Gnd and use the internal pullup, and work active-low?
+100