Recent Posts

Pages: 1 [2] 3 4 ... 10
11
Deutsch / Re: Lichtschranke Impulse zähl...
Last post by Roadrunner - Today at 08:05 am
Guten Morgen,

Bei den Ausmaßen der Eisenbahn wird I²C wohl nicht mehr klappen, da ich selber mit CAN spiele, wäre Das meine Variante.

- jeder Zp hat eine ID
- bei jeder Überfahrt wird Diese der 'Zentrale' gemeldet wie die Fahrtrichtung
- die Zentrale liest die dem Zp anliegenden Streckenabschnittsnummern
- Sie liest dann Deren aktuelle Achsenzahlen
- addiert/subtrahiert 1 (je nach Richtung
- speichert diese Achsenzahlen wieder ab
Die Idee hab ich auch schon gehabt, meine Steuerungssoftware zählen zu lassen. Habs denn aber wieder verworfen weil die den PC schon genug auslastet mit der Blockberechnung. Deswegen war mein anderer Ansatz, ich zähle oder lasse dezentral einen uC zählen und schicke denn "bloß" die Meldung frei oder nicht frei in den CAN Bus.

Quote
Jeder Streckenabschnitt hat einen 16bit Wert für die Anzahl der gezählten Achsen (0...65535 Achsen, bei 24bit bis 16777215)
Eigentlich reichts bis 252 ;-)


Quote
Verständlich?
Teilweise. Bin wie gesagt noch recht neu...

Gruß
12
Project Guidance / Multiple PCA9635
Last post by JacksonAudio - Today at 07:56 am
Has anyone had any luck with running multiple PCA9635's? I've got one running just fine using RAMBO's code here: https://github.com/rambo/pca9635

The issue is that I can't find a way to address a second unit. I mean I CAN but if I define a second unit right below the initial definition as shown below (driver.begin(97, false);) the code for 96 stops working. I assume that has to do with the standard format of the Wire library being to:

Code: [Select]
Wire.beginTransmission(44); // transmit to device #44
  Wire.write(byte(0x00)); // sends instruction byte
  Wire.write(val);        // sends potentiometer value byte
  Wire.endTransmission(); // stop transmitting




Code: [Select]
// Get this from https://github.com/rambo/I2C
#include <I2C.h> // For some weird reason including this in the relevant .h file does not work
#include <i2c_device.h> // For some weird reason including this in the relevant .h file does not work
#include <pca9635.h>
#define I2C_DEVICE_DEBUG
// Container for the device
pca9635 driver;

void setup()
{
    Serial.begin(115200);
    // Use the SW-Reset address to reset all pca9635 ICs on the bus

    // Initialize I2C library manually
    I2c.begin();
    I2c.timeOut(500);
    PCA9635.reset(); // Incidentally this global name is a pca9635 instance bound to the generla "all-call" address so it can be used to set global parameters
    // Wake oscillators on all-call
    PCA9635.set_sleep(0x0);
    delayMicroseconds(500);
    // Enable PWM controls for all leds on all-call
    PCA9635.set_led_mode(3);
    /**
     * This will set the driver to open-drain mode, 0xff will set it to the default totem-pole mode
    PCA9635.set_driver_mode(0x0);
     */

    // Set device address and call I2c.begin() (note: your need to change the address to correspond to your device)
    driver.begin(96, false); // ******** You need to change the device address here, 0x70 is the 7-bit ALL-CALL address for PCA9635 ***********
    driver.begin(97, false); // ******** You need to change the device address here, 0x70 is the 7-bit ALL-CALL address for PCA9635 ***********

    Serial.println(F("Booted"));
}

void loop()
{
    // Scan the bus, output addresses (just
    I2c.scan();
    delay(1000);
   
    // Blink leds in turn on all-call
    Serial.println(F("Blinking all drivers leds' in turn (via ALL-CALL)"));
    for (byte ledno = 0; ledno < 16; ledno++)
    {
        // Using half-brightness to make the led light up regardless of whether the drver is wired to source or sink current through it (when in totem-pole mode, open drain naturally is sink-only)
        PCA9635.set_led_pwm(ledno, 0x80);
        delay(250);
        PCA9635.set_led_pwm(ledno, 0x0);
    }
    delay(1000);
    Serial.println(F("Blinking addressed drivers leds' in turn"));
    // Blink leds in turn on the addressed instance
    for (byte ledno = 0; ledno < 16; ledno++)
    {
        driver.set_led_pwm(ledno, 0x80);
        delay(250);
        driver.set_led_pwm(ledno, 0x0);
    }

    // Dump device registers
    driver.dump_registers(0x0, 0x1b);

    delay(5000);
}


Any ideas on how to talk to a second PCA9635? It would seem that I need the ability to send an additional variable to the set_led_pwm function; namely an address variable.
13
Project Guidance / Re: Battery pack management fe...
Last post by AlfaOmega - Today at 07:55 am
Thanks for the reassurance Tom!
Glad to hear that I have not made there any glaringly obvious mistakes in this cirquit.
14
Français / Re: questions sur le tuto esp8...
Last post by al1fch - Today at 07:42 am
Bonjour
Quote
j'ai utilisé le lien json boards manager ide 1.8.4, c'est mauvais ?
Le lien actualisé pour le plugin + celui de la doc sont présents sur le github du projet



Quote
2eme vendue comme d1 minipro 16M ...uart cp2104,
apres blink, je teste exemple : checkflashconfig
real size 4194304,
 flash configuration wrong
L'IDE Arduino , ou plutôt son extension pour ESP, ne sait pas encore gérer cette carte avec sa taille flash exceptionnelle.   Je viens de découvrir l'option  Mini Pro 16M dans l'IDE .  
L'IDE connait dont maintenant la taille 16M.  
Test OK chez moi sous Windows avec une D1 Mini Pro Wemos  d(IDE 18.5, + outils ESP en 2.4.0).
Pour info la mémoire implantée sur cette carte est une Winbond 25Q128  (128 M bit, 16 M bytes)
Code: [Select]

Flash ide  size: 16777216
Flash ide speed: 40000000
Flash ide mode:  DIO
Flash Chip configuration ok



Quote
le dossier croquis ?  qui est dans documents\Arduino ou dans C:\Program Files\Arduino\tools ?
Le dossier croquis  ESP est, sous Windows ,est dans documents\Arduino comme pour les autre sketches
Le tuto mentionne bien la création d'un dossier tools dans  ce dossier , donc : documents\Arduino\tools

Quote
plugin SPIFSS : je ne l'ai pas installé, que faut-il installer ?
SI tu veux gérer le sytème de fichier en mémoire flash (SPIFSS) depuis ton sketch il n'y a rien à installer.
Si tu as besoin "d'enfourner" un gros volume de données (écriture seulement) dans la mémoire flash , ce plugin permettra de le faire 'en direct' par flashage indépendant de celui du sketch
15
Displays / Re: please help with 2.8 Spi d...
Last post by david_prentice - Today at 07:30 am
Google "HCTFT_Touch" and you should find it on GitHub.
Or go to GitHub and search for it there.

If you can't find it,    I will Zip it up and attach it for you.

David.
16
Programming Questions / Re: Automatic Headlight Help
Last post by MorganS - Today at 07:23 am
No, it appears the code never calls isiitLight() so the higher threshold isn't used. If it does what you want then that can be removed.
17
Displays / Re: MCUFRIEND_kbv Library for ...
Last post by ZinggJM - Today at 07:23 am
I am gobsmacked by two Displays with exactly the same feature.

@korko_sk,
I suggest that you ask for a refund.

@Jean-Marc,
1.  change from 8080-16 to 8080-8 interface as described in an earlier NT35310 thread.
2.  change PIXFMT to 0x06  reg(0x3A).

David.
I assume you refer to this post. So it really means I need to modify the hardware. I will do that.

Playing with hardware is half the fun. The other half is still easier for me.

Jean-Marc
18
Programming Questions / Re: Error message
Last post by MorganS - Today at 07:18 am
Please use code tags. I know you can't highlight things inside code tags but the forum software eats some of your code if you don't.

The "add listener" function connects one of your functions to the event. You have to define this function; that is, write the function. This says you have a function called keypadEvent() but it isn't in the code you showed.
19
So it can make sense to do it the intuitive way to better understand the approach and use subtraction once it's understood, or if it's likely to run to overflow.


I disagree; one should not practice doing it in a way that will fail when the sketch is allowed to run for a long period of time. It teaches bad habits, and when you modify the program and decide to put it in use for a long period of time without reset, it's very easy to forget that you have to go back and change how you do the timing.
20
Programming Questions / Re: SoftwareSerial
Last post by MorganS - Today at 07:14 am
It's time to step up to more hardware serial ports. A Teensy 3.2 is smaller than a Nano and has 3 Serial plus USB serial.
Pages: 1 [2] 3 4 ... 10