Pinout NudeMcu V3 von LoLin

Hallo zusammen,

ich bin gerade am testen für ein Kleine Projekt, ich versucht einen Sensor mit OneWire aus zu lesen. Letzt endlich habe ich es geschafft, nach einigem Probieren.

Jetzt bin ich aber etwas verwirrt:

ich hatte folgendes PinOut, bzw. habe mir ein eigenes erstellt (siehe Bilder).

Als Grundlage zum Testen habe ich das Sketch DS18x20_Temperatur aus der OneWire Bibliothek verwendet.

// http://www.pjrc.com/teensy/td_libs_OneWire.html
//
// The DallasTemperature library can do all this work for you!
// https://github.com/milesburton/Arduino-Temperature-Control-Library

OneWire  ds(10);  // on pin 10 (a 4.7K resistor is necessary)

hier wird der Pin 10 als Pin definiert. Doch leider habe ich keine Beschreibung gefunden wo diese Pinnummeriernung aufgelistet ist.

Nach einigen versuchen habe ich herausgefunden dass Pin 10 SK ist. (Siehe Bild Anschluss DS18B20)

woher her weiß ich nun wie gezählt wird?

PinOut.PNG


wie du siehst ist D10 TX0, also nutze einen anderen Pin

ardubu:
wie du siehst ist D10 TX0, also nutze einen anderen Pin

Das stimmt nach meiner Meinung nicht, da am ESP8266 die Pins anders gezählt werden, als am Arduino.

Die Pinbezeichnung 10 ist GPIO10 (also D12), nicht TX0.

Gruß Tommy

stimmt
10 --> GPIO10 --> D12
D10--> GPIO1 --> TX0

Sorry aber irgendwas passt da so nicht.

Wenn ich wie onewire ds(10) definiere dann lade ich auf SCK und da musste erst durch testen herausfinden.

Wenn ich allerdings einen output definiere und z.B. ein Relais ansteuere dann ist 10 auch GPIO 10

Chrisbie:
..... ein Relais ansteuere dann ist 10 auch GPIO 10

10 ist immer GPIO10!
Aber nicht D10!

#define PIN_WIRE_SDA (4)
#define PIN_WIRE_SCL (5)

static const uint8_t SDA = PIN_WIRE_SDA;
static const uint8_t SCL = PIN_WIRE_SCL;

#define LED_BUILTIN 16

static const uint8_t D0 = 16;
static const uint8_t D1 = 5;
static const uint8_t D2 = 4;
static const uint8_t D3 = 0;
static const uint8_t D4 = 2;
static const uint8_t D5 = 14;
static const uint8_t D6 = 12;
static const uint8_t D7 = 13;
static const uint8_t D8 = 15;
static const uint8_t D9 = 3;
static const uint8_t D10 = 1;

nodemcu/pins_arduino.h

Gruß Fips

in der Versionskontrolle der Lib steht unter 2.0

Use direct optimized I/O in all cases

und in der util/OneWire_direct_gpio.h findet sich folgendes:

#elif defined(ARDUINO_ARCH_ESP8266)
// Special note: I depend on the ESP community to maintain these definitions and
// submit good pull requests.  I can not answer any ESP questions or help you
// resolve any problems related to ESP chips.  Please do not contact me and please
// DO NOT CREATE GITHUB ISSUES for ESP support.  All ESP questions must be asked
// on ESP community forums.
#define PIN_TO_BASEREG(pin)             ((volatile uint32_t*) GPO)
#define PIN_TO_BITMASK(pin)             (1 << pin)
#define IO_REG_TYPE uint32_t
#define IO_REG_BASE_ATTR
#define IO_REG_MASK_ATTR
#define DIRECT_READ(base, mask)         ((GPI & (mask)) ? 1 : 0)    //GPIO_IN_ADDRESS
#define DIRECT_MODE_INPUT(base, mask)   (GPE &= ~(mask))            //GPIO_ENABLE_W1TC_ADDRESS
#define DIRECT_MODE_OUTPUT(base, mask)  (GPE |= (mask))             //GPIO_ENABLE_W1TS_ADDRESS
#define DIRECT_WRITE_LOW(base, mask)    (GPOC = (mask))             //GPIO_OUT_W1TC_ADDRESS
#define DIRECT_WRITE_HIGH(base, mask)   (GPOS = (mask))             //GPIO_OUT_W1TS_ADDRESS

ich kanns dir nicht erklären und vieleicht bin ich auch auf der falschen Spur. Aber ich würde mich einfach mit "reagiert halt anders als digitalwrite" abfinden.

ich kanns dir nicht erklären und vieleicht bin ich auch auf der falschen Spur.

Da hat Derfips völlig Wahr!

Für jedes Board gibt es eine pins_arduino.h, in welcher sich die Zuordnung der Pins verbirgt.
Mal mehr, mal weniger, offensichtlich.