Recent Posts

Pages: [1] 2 3 ... 10
1
Deutsch / Re: Schleife gesucht mit 7 Aus...
Last post by MicroBahner - Today at 10:02 am
Hallo Uwe,
nun verunsichere mal unsere Einsteiger nicht so  ;)
Natürlich funktioniert das so - ist ja eigentlich auch das Gleiche wie im von dir verlinkten Post.
Was nicht funktioniert wäre, wenn man millis direkt mit dem gewünschten Intervallende vergleicht:
Code: [Select]
if ( millis() > intervallEnde ) {
    intervallende += 10000;
    ...
}
Das würde beim Überlauf zu Problemen führen. Wichtig ist die Differenzbildung zum Intervallanfang. (N.B. die obige Version würde auch funktionieren, wenn man alles als vorzeichenbehaftetes long castet. Das hat dann aber andere Nebenwirkungen )
Das von mir verwendete
Code: [Select]
lastCall += 10000;
anstelle von
lastCall = millis();
ist exakter bei der Intervallbildung. Im Normalfall wird man den Unterschied nicht merken, aber man macht im 2. Fall einen prinzipiellen Fehler - die Intervalle sind immer etwas zu lang. Wenn Du das z.B. verwenden willst, um eine interne Uhr im Sekundentakt weiterzuschalten wirst Du das sehr schnell merken.
2
Project Guidance / 3 pwm signals to 24v
Last post by alioth - Today at 10:02 am



Hi! Im new here, and not a lof time with arduino and electronics.


I have to drive a gauge, which is the receiver in the following diagram:





So, I have to generate the signals needed with Arduino. I have to simulate the left part of the diagram.
The gauge says 24v. I need 3 outs from 0 to 24v.

I thought it was easy with 3 transistors, but I cant get it work. I have try with npn and pnp transistors.  I can see with multimeter 0 to 24v for each output, but i dont see any voltaje between them. I supose the transistors cuts it off.


It works with direct 3 pwm 5v signals with arduino. (not, perfect, because it needs 24v to get enough torque). It is only 10mah current at 5v.
But it doesnt work when I try to convert to 24v with transistors.

How can I get those 24v outputs?

Thanks in advance.












3
Français / Re: Problème d'affichage de l'...
Last post by MANUPAT - Today at 10:00 am
Bonjour,
effectivement le problème vient visiblement de l'utilisation de la lib Onebutton qui n'est pas adaptée à ce que je veux faire.
Je vais tout rebasculer dans le programme principal et déclencher ma machine à état sur la détection de changement d'état du bouton poussoir.
Merci pour vos précieux conseils.
Je travail la dessus (relecture des tutos et posts...)
A bientôt
4
Hi guys,
I'm struggling with an issue since 2 weeks and I cannot find any solution. I'd like to make a raspberry pi 3 and an arduino pro mini (3.3V) talking via i2c. I connected them directly since the raspberry pi 3 already has pull up resistors. Previous to this, I was able to make the raspberry pi 3 and an HTU21D sensor via i2c talking successfully, so I'm excluding hardware issues on raspberry pi, I'm guessing something is wrong with the arduino, and since changing the arduino module didn't fix the issue I have a software issue and cannot find what can be.
the arduino code (only the i2c part):

Code: [Select]
#include <Wire.h>

#define slaveAddress 0x08

byte  command = 0;

byte  txTable[4];                               //for sending data over I2C
byte  rxTable[4];                               //for sending data over I2C
bool  newDataAvailable;

void setup() 

  Serial.begin(9600);
 
  newDataAvailable = false; 

  Wire.begin(slaveAddress);         //I2C slave address
  Wire.onReceive(i2cReceive);       //register handler onReceive
  Wire.onRequest(i2cTransmit);      //register handler onRequest
 
}//setup

void i2cReceive(int byteCount) {
  if (byteCount == 0) return;
 
  //the first byte is the command 
  command = Wire.read();
  if (command < 0x80)
  {
    //it is a receiving data command, we have to handle the next bytes
    i2cHandleRx(command);
  }
}

byte i2cHandleRx(byte command) {
  // The I2C Master has sent data, store them in receiving buffer
  byte result = 0;
 
  switch (command) {
    case 0x0A:   
     
      if (Wire.available() == 4)
      {
        for (int i = 3; i >= 0; i--)
          rxTable[3-i] = Wire.read();
       
        result = 4;
      }
      break;     
  }
  if (result != 0)
    newDataAvailable = true;

  return result;
}

void i2cTransmit() {
  //called by event
  byte numBytes = 0;
   
  switch (command) {
    case 0x90:
      numBytes = 4;
      break;
  }
  if (numBytes > 0) {
    Wire.write((byte*)txTable, numBytes);
  }
}


Data are stored in the txByte array in the loop method. I can successfully send data from raspberry pi to arduino, but I cannot read data from it. Using some print to the monitor I can see that the arduino is reacting to the master requests. On raspberry pi I'm using python-smbus, so the command:

Code: [Select]
import smbus
bus = smbus.SMBus(1)
data = [0,50,100,100]
bus.write_i2c_block_data(0x08, 0x0A, data)


is working. But the command:

Code: [Select]
import smbus
bus = smbus.SMBus(1)
data = bus.read_i2c_block_data(0x08, 0x90, 4)


raises the error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IOError: [Errno 5] Input/output error


I'm wondering what I'm doing wrong on data transmission.

Does anyone has an idea?

Thank you.

Regards.
5
I have no idea. If something is working by "accident" a small change will probably cause it to go awry.
And that's exactly the reason why it's mandatory to dig as deep as possible into this!

I'll upload a new code after some mod.
6
hello can anyone help me with my code it detecting pulse
When I have code like that I add a line newPulse = true; into my ISR and then I can easily test for that in loop() and when I have read the ISR values I can set it back to false

Something like this
Code: [Select]
void coinacceptor()     
{
  CoinPulseCount++;
  PulseTime = millis();
  newPulse = true;
}

and then in loop() I would have
Code: [Select]
if (newPulse == true) {
   noInterrupts();
     latestPulseCount = PulseCount;
     latestPulseMillis = PulseTime;
     newPulse = false;
   interrupts();
}

 
Note the use of noInterrupts() to prevent the ISR changing the values while you are reading them. Also I have copied the ISR values into other variables for use elsewhere in loop()

...R
7
Can you suggest a solution ?
8
Hallo ich versuche ein Menu für den touchscreen  elegoo 2.8 zu bekommen.
Ich verwende die beispieldatei  arduino Menu libarrie.Der tft steckt  direkt auf dem Uno.
Gibts tipps oderHinweis die ihr mir geben könnt?
9
Français / Re: AQUABOUN'S /// GESTION D'A...
Last post by djbouns - Today at 09:51 am
jessaie ...
10
Français / Re: AQUABOUN'S /// GESTION D'A...
Last post by djbouns - Today at 09:51 am
peut etre pasrque le gsm n'est pas mis en mode texte ?
Pages: [1] 2 3 ... 10