-
Notifications
You must be signed in to change notification settings - Fork 13.2k
NewPing not working when using pins D5-D8 #1914
Copy link
Copy link
Closed
Description
Basic Infos
Hardware
Hardware: ESP-8266EX (WeMos D1 mini)
Core Version: 2.1.0
Description
NewPing not working when using pins D5-D8.
Settings in IDE
Module: WeMos D1 R2 mini
Flash Size: 4MB/3MB
CPU Frequency: 80Mhz
Upload Using: SERIAL
Sketch
#define PIN D6 // Not working
// #define PIN D3 // Working
uint32_t _triggerBit = digitalPinToBitMask(PIN); // Get the port register bitmask for the pin.
volatile uint32_t *_triggerOutput = portOutputRegister(digitalPinToPort(PIN)); // Get the output port register for the pin.
volatile uint32_t *_triggerMode = (uint32_t *) portModeRegister(digitalPinToPort(PIN)); // Get the port mode register for the pin.
void setup() {
*_triggerMode |= _triggerBit; // Set trigger pin to output.
}
void loop() {
*_triggerOutput &= ~_triggerBit; // Set the trigger pin low
delay(1000);
*_triggerOutput |= _triggerBit; // Set trigger pin high
delay(1000); // wait for a second
}Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels