Recent Posts

Pages: [1] 2 3 ... 10
1
One or two busses does not matter, it is the same waiting when using the Wire library. It is never executed at the same time. In most cases it is no problem to wait a millisecond a number of times per second.

It is the same for the SPI bus. They are not run simultaneously.

Arduino was designed by a student. It is ment for easy prototyping and it is easy to use and it is to make a smooth start to learn programming. That turned out to be very successful.

Arduino was not designed by a team of software engineers with decades of experience with a event driven realtime preemtive multitasking software.

You don't have to use Arduino. With the Atmel Studio you can write your own code.

Which sensor(s) do you use and what is it for ? A common mistake is when someone has code with a lot of delay(), either in the sketch or in libraries, and tries all kind of weird solutions instead of removing the all the delay(). For a fast responding Arduino, avoid the delay() and don't use NeoPixel, FastLED, DHT, or OneWire libraries. Perhaps you should avoid the SD memory card library as well, the Arduino does not have a hardware controller for that, everything is done in software.
You have not shown us any code, therefor I wonder what your code looks like.

2
Hello Every One

im trying to use if condition in vb when serial port read from arduino
so i wana when i get value like "A" in textbox do action and not working !! i receive value but if condition not become true idont know why so can anyone can help me !!


arduino code :

Code: [Select]

char data;
int A = 13;
int B = 12;
int C = 11;
int D = 10;


void setup() {
  // put your setup code here, to run once:
Serial.begin(9600);
pinMode(A,OUTPUT);
pinMode(B,OUTPUT);
pinMode(C,OUTPUT);
pinMode(D,OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
while (Serial.available()>0){
  data=Serial.read();
  if (data == 'z'){
      digitalWrite (13,HIGH);
      Serial.println("A");}
     
   if (data == 'x'){
      digitalWrite (13,LOW);
      Serial.println("A OFF");}
   
     if (data == 'c'){
      digitalWrite (12,HIGH);
      Serial.println("B ON");}
     
 if (data == 'v'){
      digitalWrite (12,LOW);
      Serial.println("B OFF");}

    if (data == 'b'){
      digitalWrite (11,HIGH);
      Serial.println("C ON");}

   if (data == 'n'){
      digitalWrite (11,LOW);
      Serial.println("C OFF");}

    if (data == 'm'){
      digitalWrite (10,HIGH);
      Serial.println("D ON");}

   if (data == 'l'){
      digitalWrite (10,LOW);
      Serial.println("D OFF");}
} }



VB Code :

Code: [Select]

Imports System.IO.Ports

Public Class Form1

    Private Sub SerialPort1_DataReceived(ByVal sender As System.Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
        Dim Sdata As String = SerialPort1.ReadLine()
        TextBox2.Clear()
        TextBox2.Text = Sdata
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Windows.Forms.Control.CheckForIllegalCrossThreadCalls = False
        SerialPort1.Open()
        Timer1.Start()

    End Sub

    Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
        If e.KeyCode = Keys.Enter Then
            SerialPort1.Write(TextBox1.Text)
            TextBox1.Clear()
        End If
    End Sub

End Class



Please Only i need if condition when serial port get value from arduino and make it true
3
What output are you seeing on the screen?

My first thought is that the function runsl() may be returning prematurely. You send a command, then immediately record the response. It can take several seconds for the response to arrive, by which time you will have sent several more commands. A more elegant way would be to wait until you get a response, then keep reading until you are sure there are no more characters to come.
4
Project Guidance / Re: Atmega2560 a lot slower th...
Last post by LukaQ - Today at 08:44 am
It seems that if you have
Code: [Select]
attachInterrupt(2, doEncoderA, CHANGE);
attachInterrupt(3, doEncoderB, CHANGE);

is not the same
Code: [Select]
attachInterrupt(digitalPinToInterrupt(18), doEncoderA, CHANGE);
attachInterrupt(digitalPinToInterrupt(19), doEncoderB, CHANGE);


I think this has changed, over several versions of Arduino IDE, since this is what is says for attachInterrupt

Quote
attachInterrupt(digitalPinToInterrupt(pin), ISR, mode);   (recommended)
attachInterrupt(interrupt, ISR, mode);   (not recommended)
attachInterrupt(pin, ISR, mode);   (not recommended Arduino Due, Zero, MKR1000, 101 only)
5
Deutsch / Re: LCD-Display wird schwach /...
Last post by Theseus - Today at 08:43 am
Wenn ich das richtig sehe, dann erfolgt die Kommunikation ESP32-LCD nur in Richtung LCD. Deshalb kann man die Versorgungsspannung VDD aus dem 5V-Pin des ESP nehmen. Das LCD sollte dann auch ohne Level-Shifter wie gewünscht funktionieren. Falls ich was übersehen habe, bitte korrigiert mich.
6
Bar Sport / Re: URGENT - need help
Last post by GoForSmoke - Today at 08:42 am
Reactionary as in hard-wired like gates and logic arrays? Capacitive touch controls on lamps go back to early analog electronics and are as reactionary as it gets.

The aim with controllers is replacing bunches of that with cheap yet feature rich chips and good code. Cap sense is easy to bit-bang and easier for controllers with cap sense ports in a small fraction of a millisecond you might check once every 20 milliseconds, if you write code that never blocks.

If you want to know about blocking code and how NOT to write it, check the 1st Nick Gammon link in the space just below.
The 2nd link covers serial input and an example of a simple state machine. If you get that far, you can write good code. :)
7
Français / Re: tester si arduino connecté...
Last post by 3Sigma - Today at 08:38 am
Bonjour,

Le problème des solutions matérielles c'est que:

Si l'arduino est connecté sur un pc via la prise usb et qu'un moniteur série est démarré, j'envoie sur le moniteur série.
Rien ne va malgré tout indiquer si un moniteur série est démarré ou pas. A mon avis il faudrait quand même creuser ce qui est réalisable logiciellement avec un genre de "ping".
8
Français / electrovanne 5v pour arduino
Last post by scalvier - Today at 08:33 am
Bonjour
je suis à la recherche d'une électrovanne toute simple pour ouvrir et fermer l'alimentation en eau d'un mur végétal intérieur. L'eau devra s'écouler par gravité.
Je vais utiliser un Arduino Uno et un capteur d'humidité, l'ensemble sera alimenté électriquement par des piles
Toutes les électrovannes trouvées sur internet sont en 12V et nécessitent de passer par un circuit de puissance.
Existe-t-il des modèles en 5V et 40 mA pour éviter de passer par un relai ?
Merci pour votre attention et vos réponses



9
Project Guidance / Re: AlaLed RgbStripSequence-ba...
Last post by Relign - Today at 08:28 am
I DID IT!! I Cracked it!! Myself!!!!

Code: [Select]
AlaLedRgb rgbStrip;

// custom palette :         black     white     black     red       green     blue
AlaColor mycolors_[6] = { 0x000000, 0xFFFFFF, 0x000000, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF };
AlaPalette mycolors = { 6, mycolors_ };

AlaSeq seq[] = {
  { ALA_OFF,            1000, 1, alaPalNull },
  { ALA_BUBBLES,        100, 1800, mycolors },
  { ALA_ENDSEQ }
};

void setup() {

  rgbStrip. initWS2812 (60, 6);
 
  rgbStrip. setBrightness (0x66FF44); //THIS is the blueish white

  rgbStrip. setAnimation(seq);


I think I can go now and find out how to close this post. Thanx every respondant!!
10
The input mode of the button pin is INPUT_PULLUP so when not pressed it will be HIGH.  I assume that you have it wired to go LOW when pressed, or have you ?

In the Button() function you have
Code: [Select]

  if (digitalRead(D4) == HIGH)
    buttonmillis = millis();
so buttonmillis will be set to millis() only when the button is not pressed.  Is that what you meant to do ?

What is it that you are trying to do ?

Did you look at the StateChangeDetection example in the IDE ?
Pages: [1] 2 3 ... 10