8000 Blocks for Interrupts bad generated code · Issue #136 · OttoDIY/blockly · GitHub
[go: up one dir, main page]

Skip to content

Blocks for Interrupts bad generated code #136

Open

Description

@cparrapa

i think there is quite another problem. Blockly picks up the wrong C++ statement causing the interrupt not seen.
\the statement for interrupt in blockly should translate int: attachInterrupt (digitalPinToInterrupt (BUTTON), switchPressed, CHANGE);

The statement should be of the form " attachInterrupt (digitalPinToInterrupt (BUTTON), switchPressed, CHANGE);" .

Issue is that the nano and uno interrupt handling is not that flexible.

to do some Realtime event handling with Otto (and nano) you must have good interrupt handling.

a. the setup should include digitalWrite (BUTTON, HIGH), this has to do with internal pullup resistor. I don't know exactly why, Arduino reference may have more info. However this is not relevant for the attach issue.
b. the interrupt attach should definitely be of the form:
attachInterrupt (digitalPinToInterrupt (BUTTON), switchPressed, CHANGE);
the attach statement which currently is in the bloc does not work for some reason. This one does. I added 8000 a buzzer with two tones to check if it really works, it does. I forgot to save that one. I don't know WHY your original attach doesn't work, requires more study or testing.
c. within the ISR you included a statement Read Digital state Pin (BUTTON) = 10 , THAT SHOULD BE 1 , OR HIGH. The 10 doesn't work. This is also not relevant to the attach issue as its inside the ISR which can be anything.

But of course the main thing is b. above, to change the attachInterrupt statement in your interrupt block. There is also info on that in the Arduino reference site.

Perhaps its possible to make two versions of your bloc, in case there is a dependency i am not aware off.

image

Activity

  1. logix5 commented on Jan 13, 2022

    @logix5
    Contributor
  2. changed the title [-]Interrupts blocks bad generated code[/-] [+]Blocks for Interrupts bad generated code[/+] on Jan 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    0