Comments (3)
Hello @dhalbert , i modified your text and it seems to be working :
void setup()
{
Serial.begin(9600);
pinMode(A0, INPUT);
}
void loop() {
// Attach A0 to 3.3V through a 220K or other high-value resistor,
// so it's not stronger than the driven output.
delay(100);
Serial.println(analogRead(A0));
delay(100);
Serial.println("Done");
}
the problem is still the same with touchsceen... but i'm wondering if it's not just about a pins definition problem ?
from arduinocore-mbed.
@MattGlobal In the example you gave, there is no pinMode()
between analogRead()
calls. In my example, the pin usage alternates between pinMode()
and analogRead()
. My hypothesis is that the second call to analogRead()
is assuming the pin is already set up where as in fact its settings where changed "behind the back" of analogRead()
.
from arduinocore-mbed.
Here is the impl:
ArduinoCore-mbed/cores/arduino/wiring_analog.cpp
Lines 101 to 121 in 68fbece
The first time through, a new
mbed::AnalogIn
object is created. That's reused on subsequent calls.
A workaround might be to call analogUpdate()
before every call to analogRead()
. I'll try that. (EDIT: ANALOG_CONFIG
isn't defined, so analogUpdate()
is not included, so it requires some surgery in the sources, which is not a clean workaround for the average user.) But there's an assumption being made in the code in this file that the pin state is not changing out from under analogRead()
.
from arduinocore-mbed.
Related Issues (20)
- Best Practice change uart0 pins?
- Camera: methods getResolutionWidth and getResolutionHeight are not implemented HOT 2
- camera: FrameBuffer::FrameBuffer(int32_t x, int32_t y, int32_t bpp) might trash memory HOT 2
- GIGA R1 - increase MBED_CONF_LWIP_TCP_SOCKET_MAX
- ipv6 portenta H7 / opta
- Inconsistencies between Ethernet libraries of different architectures HOT 4
- OPTA Ethernet.linkStatus() not returning LinkON HOT 6
- GIGA R1 - USBMSD constructor arg connect_blocking seems to have no effect HOT 1
- WiFi - Ethernet issue HOT 3
- RPC.send() doesn't handle messages that spill a buffer HOT 8
- ChatServer.ino not working HOT 1
- Modify VID/PID and USB device name
- Connectivity to hidden WiFi networks
- GIGAR1: conflict between Access Point and common WiFi connection HOT 5
- Question on improving `arduino::WiFiClass::statusCallback` HOT 2
- Compiling with WiFi.ping() throws undefined reference to `arduino::WiFiClass::ping(arduino::String const&, unsigned char)' HOT 1
- bug in SDRAM defrag HOT 1
- How to define my own pins for PDM microphone (board, nano 33 BLE) HOT 1
- Dual Core Processing on Portenta H7 using one Sketch: issue with core 4.0.10 and 4.1.1. HOT 6
- Arduino Nicla Sense ME - SPI Slave support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arduinocore-mbed.