Recent Posts

Pages: 1 [2] 3 4 ... 10
11
Deutsch / Re: Steuerung von Ventilen und...
Last post by Serenifly - Today at 01:10 pm
Das Problem ist dass es kaum kleine N-FETs gibt die nicht SMD sind. So landet man meistens sofort bei TO-220 oder TO-251 Gehäusen. In letzterem ist der IRLU024 (17A) ist ein klein wenig kompakter als der IRLZ44

Der IRLD024 ist DIP4 und macht ca. 2A
12
Project Guidance / Re: Detect if component is mis...
Last post by Ballsack - Today at 01:10 pm
I managed to solve this I think. I also managed to damage my FPS device so I can't test if it works 100% but it seems to do what it should. Atleast when the FPS is disconnected.

I created a new function so that I can check the status of the FPS whenever I feel like it. This saves the value to EEPROM and in the loop function I check the value of the EEPROM. The previous issue of the Arduino stopping when the FPS was disconnected is solved by the second peace of code. I added "return 0" so that it jumps over that part so that the loop is allowed to continue. I will create a function later on that tells the "Admin" that something is wrong.

Thanks for the support and help guys!

Code: [Select]

bool FPS_GT511C3::Status()
{
byte firstbyte = 0;
bool done = false;
_serial.listen();
firstbyte = (byte)_serial.read();
if (firstbyte == Response_Packet::COMMAND_START_CODE_1) {
EEPROM.write(0, 1);
return 1;
} else {
EEPROM.write(0, 0);
return 0;
}
};



Code: [Select]

// Gets the response to the command from the software serial channel (and waits for it)
Response_Packet* FPS_GT511C3::GetResponse()
{
byte firstbyte = 0;
bool done = false;
_serial.listen();
while (done == false) {
if (Status() == 1) {
firstbyte = (byte)_serial.read();
if (firstbyte == Response_Packet::COMMAND_START_CODE_1) {
done = true;
}
} else {
return 0;
}
}
byte* resp = new byte[12];
resp[0] = firstbyte;
if (Status() == 1) {
Serial.print("Error1");
for (int i=1; i < 12; i++) {
while (_serial.available() == false) delay(10);
resp[i]= (byte) _serial.read();
}
} else {
return 0;
}
Response_Packet* rp = new Response_Packet(resp, UseSerialDebug);
delete resp;
if (UseSerialDebug)
{
Serial.print("FPS - RECV: ");
SendToSerial(rp->RawBytes, 12);
Serial.println();
Serial.println();
}
return rp;
};
13
Audio / Re: A bunch of questions about...
Last post by Grumpy_Mike - Today at 01:05 pm
Quote
Do you mean that many mandatory functions inevitably consume a significant amount of time and it's impossible to achieve a 100% perfect timing?
Yes. And that is with a task that contains only the one instruction, you will have to insure that all your tasks complete in significantly shorter time than the sample rate. Even then there will be a jitter of a time period equal to the length of your longest task. Using a delay is just a "baby" stop gap used as a demonstration or where you don't want to do anything else while a sound is playing.

Quote
at least is comprehensible that even delayMicroseconds is accurate enough
Any delay is blocking so your processor can not do anything else while it is waiting. A jitter of 4uS might not be noticeable at the low quality you have at the moment but it will soon show up as noise on your output. Remember 4uS equates to 64 clock cycles, about the same time as a digital write function call.
14
Software / Re: contagiri sensore hall (RP...
Last post by gpb01 - Today at 01:03 pm
1. come ti avevo scritto il codice, in conformità al REGOLAMENTO, punto 7, DEVE essere racchiuso tra i tag CODE (... sono quelli che in edit inserisce il bottone fatto così: </>, tutto a sinistra).

2. Non ci hai detto che Arduino stai usando ... dato che i pin disponibili per attachInterrupt() cambiano da modello a modello ... non possiamo sapere se quanto scrivi è corretto o meno.

Guglielmo
15
I've set up a matrix of neopixels and with the push of a button I want a random pixel to light up along with a user defined number of neighboring pixels in a cross. What I've got so far is this:

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

#define pixelPin 6
#define buttonPin 7

#define numPixels 80
#define stripLength 20

int vNeighbors = 2; // neighboring vertical pixels in each direction stretching from active pixel
int hNeighbors = 2; // neighboring horizontal pixels in each direction stretching from active pixel

int addVNeighbor[] = {}; int y;
int addHNeighbor[] = {}; int z;

int buttonState;
int prevState;

int currentPixel;

Adafruit_NeoPixel strip = Adafruit_NeoPixel(numPixels, pixelPin, NEO_GRB + NEO_KHZ800);

void setup() {
  strip.begin();
  strip.show();
  pinMode(buttonPin, INPUT);
  Serial.begin(9600);

  for (int v = -vNeighbors; v < vNeighbors; v++) {
    if (v < numPixels) addVNeighbor[y] = v;
    Serial.print("v: "); Serial.print(addVNeighbor[y]); Serial.print(", ");
    y++;
  }
  Serial.println();
  
  for (int h = -hNeighbors; h < (hNeighbors + 1); h++) {
    int neighbor = stripLength * h;
    if (neighbor < numPixels) addHNeighbor[z] = neighbor;
    Serial.print("h: "); Serial.print(addHNeighbor[z]); Serial.print(", ");
    z++;
  }
  Serial.println();
}


I've left out the void loop because the problem appears in the void setup where the above code shows

v: -2, v: -1, v: 0, v: 1,
h: -40, h: -20, h: 0, h: 20, h: 40,

in the monitor, which makes sense, but when I add (vNeighbors + 1) in the first for loop, like so:

Code: [Select]

for (int v = -vNeighbors; v < (vNeighbors + 1); v++) {
  if (v < numPixels) addVNeighbor[y] = v;
  Serial.print("v: "); Serial.print(addVNeighbor[y]); Serial.print(", ");
  y++;
}
Serial.println();


I get an endless stream of "v:"'with no line break in the monitor and nothing else...

When I switch places on the two loops, I get

h: -40, h: -20, h: 0, h: 20, h: 40,
v: -18248, v: -18248, v: -18248, v: 184, v: 2,

in the monitor, which to me makes absolutely no sense whatsoever.

I just don't get what's missing, and would appreciate any help at all.
16
Deutsch / Re: Attiny13 bothloader brenne...
Last post by Klaus_ww - Today at 01:02 pm
Deine Plus-Versorgungsschiene hängt in der Luft  :)
17
Deutsch / Re: Attiny13 bothloader brenne...
Last post by Klaus_ww - Today at 01:01 pm
Ich hab schon zig 13er Tinys programmiert mit meinem Uno, geht also grundsätzlich. Die Cores sind meist das Problem, also schau ich mal zuhause welche Cores mit welcher IDE Version funktionieren.

Oder klebst Du an einer speziellen IDE-Version fest?
18
Sensors / Re: Having a problem with the ...
Last post by Arctic_Eddie - Today at 01:00 pm
Put a delay of 1ms between each reading. Also, be sure the sensors are not seeing air currents.

What kind of variation do you see.?

PS
Move the capacitor to the thermistor as it's more likely to be an instantaneous source of noise.
19
Deutsch / Re: Attiny13 bothloader brenne...
Last post by Gundelputz - Today at 12:59 pm
hier noch mal ein Bild von meinem Aufbau
20
Français / Rendre l’appui d’un bouton pou...
Last post by roman68 - Today at 12:59 pm
Bonjour  :D .

Je suis nouveau sur ce forum et en programmation sur l'arduino, j'ai besoin que lorsque j'appuis sur un bouton poussoir faut que l'appui soit maintenus pendant 3 sec  (par exemple) et au bout de se délais la une LED s'allume (par exemple).

J'ai passé un sacre temps a chercher des tuto sur internet mais jais rien trouver  :smiley-confuse:

Je m'en doute que faut que j'utilise la fonction Millis mais j'arrive vraiment pas a maitre au point la structure du programme.

Merci pour votre aide  :smiley-wink:   
Pages: 1 [2] 3 4 ... 10

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy