Skip to content

Pin not "writable" after tone() #5306

Closed
@fabianoriccardi

Description

@fabianoriccardi

Basic Infos

  • [ X] This issue complies with the issue POLICY doc.
  • [ X] I have read the documentation at readthedocs and the issue is not addressed there.
  • [X ] I have tested that the issue is present in current master branch (aka latest git).
  • [ X] I have searched the issue tracker for a similar issue.
  • [X ] If there is a stack dump, I have decoded it.
  • [ X] I have filled out all fields below.

Platform

  • Hardware: ESP-01
  • Core Version: 8ae0746
  • Development Env: Arduino IDE
  • Operating System: Windows

Settings in IDE

  • Module: Wemos D1 mini v3.0.0
  • Flash Mode: dio
  • Flash Size: 4MB
  • lwip Variant: v2 Lower Memory
  • Reset Method: ?
  • Flash Frequency: 40Mhz
  • CPU Frequency: 80Mhz
  • Upload Using: SERIAL
  • Upload Speed: 921600

Problem Description

I'm using tone(..) function to play some melodies on a passive buzzer (this is my breakout: https://robotdyn.com/buzzer-module.html). After the melody, I should standby the buzzer to save energy, so I have to write 1 on the digital pin. I observed that after the tone function is impossible to command that pin, it stays low. The problem is not hardware, since this behaviour is observable even without a buzzer...

MCVE Sketch

#include <Arduino.h>

void setup() {
  pinMode(D6,OUTPUT);
  digitalWrite(D6, HIGH);  // the pin really goes HIGH
  delay(5000);

  tone(D6,1000,500);
  delay(1500);
  noTone(D6);   // This makes no difference, I was thinking it is necessary to "release" the pin...
  
  pinMode(D6,OUTPUT);
  digitalWrite(D6, HIGH);  // It stays low
}

void loop() {

}

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions