Recent Posts

Pages: [1] 2 3 ... 10
1
Project Guidance / Multiple ds18b20 to php
Last post by Landix - Today at 08:55 am
I try to send 2 values of 2 ds18b20 to a php site.

my values are in loop:

Code: [Select]

...
const char* host = "192.168.0.70";
const char* route = "/test.php?";
...

void loop() {
  float temp_0;
  float temp_1;
  DS18B20.requestTemperatures();
  temp_0 = DS18B20.getTempCByIndex(0); // Sensor 0 will capture Temp in Celcius
  temp_1 = DS18B20.getTempCByIndex(1); // Sensor 0 will capture Temp in Celsius

  Serial.print("Temp_0: ");
  Serial.print(temp_0);
  Serial.print(" oC . Temp_1: ");
  Serial.print(temp_1);
  Serial.println(" oC");
  delay(1000);


I think i need both values in a string and i tried:

Code: [Select]
Serial.println();
  WiFiRestClient restClient( host );

  Serial.print( "Posting to http://" );
  Serial.print( host );
  Serial.println( route );
----
 i struggle here:
  char buf[256];
  sprintf(buf, "Temp_0=%s&Temp_1=%s, temp_0, temp_1);
  Serial.print( buf );
  Serial.println( " " );
 
  int statusCode = restClient.post( route, buf);

---------


  Serial.print ("Status received: " );
  Serial.println( statusCode );


I am sure somebody have done this before?
I didnt make it work :(
2
Hi,
From what I can see of your code you need to ask only two questions.

  • IF nescafe button HIGH and milo button LOW then nescafefunctom
  • IF milo button HIGH and nescafe button LOW then  milofunction.


You only need two IF statements to cover  your two possibilities, any other combination will not jump into the functions.

Tom... :)
3
Deutsch / Re: Nextion 3,5'' Display - kl...
Last post by HotSystems - Today at 08:52 am
Ich vermute mal, es gibt einen Konflikt zwischen deinem Schreiben auf das Display und dem Auswerten der Touchfunktion.

Ich hatte ähnliche Probleme bei meinem Radiowecker.
Da musste ich das Schreiben auf das Display abschalten, wenn ich Touch auswerten wollte.
4
Deutsch / Sinus via PWM, Metro library
Last post by Bilo123 - Today at 08:48 am
Hallo,

ich versuche mit Hilfe der Metro library mein eigenes PWM Signal zu erzeugen. (Schlussendlich soll ein Sinus via PWM erzeugt werden.)
Dazu mein Versuch:
Code: [Select]

#include <Metro.h>

#define Speaker 3

Metro active = Metro(250);  //Initialisierung der Timer für PWM
Metro inactive = Metro(500);

void setup() {
  pinMode(Speaker, OUTPUT);
  digitalWrite(Speaker,HIGH);
}

void loop() {
 
   if (active.check() == 1) {  //Falls das active Intervall abgelaufen ist
      digitalWrite(Speaker,LOW);
      inactive.interval(250);    // Setzt das inactive.Intervall auf 250ms
      active.interval(10000);   // Setzt das active.Intervall auf 10s, damit die obige Bedinung "nie" erfüllt wird
      }

   
       
   if (inactive.check() == 1) { //Falls das inactive.Intervall (das 250ms beträgt) abgelaufen ist
        digitalWrite(Speaker,HIGH);
        active.interval(250);     //Setzt das active.Intervall auf 250ms
        inactive.interval(10000); // Setzt das active.Intervall auf 10s, damit die obige Bedinung "nie" erfüllt wird
        }
     
}


Nach meiner Überlegung sollte so der Pin alle 250ms auf HIGH bzw. LOW gesetzt werden. Er ist aber ständig auf HIGH.
Sieht jemand meinen Fehler?
Wie muss ich die Intervall-Länge setzten, damit es passt?

Gruß
5
I realised an error I was making in calculating the impedance.
Quote
2.9A @ 800 mm/min = 213pps. nominal inductance = 2.14 R.
800 /5./60. *200   = 533 pps

800 /5./60. *200  *2*pi *1.6e-3  = 5.36 ohm

52 / (5.36+1)   = 8.17 A cf 2.9A measured being pulled from the supply , feeding two phases.

The motor is 6 wire bipolar, I am assuming that the 1.6mH is each of phase two windings, not each half measured at the centre tap. That is not specified.

It would not be desirable to push more than 3A RMS into the windings since they will saturate, but I should be able to get 3A at a higher speed and this is not happening.

6
Français / Re: Gérer un moteur avec un jo...
Last post by infobarquee - Today at 08:46 am
bonjour,
définis un point neutre de ton joystick avec une petite fourchette.
pour le faire, utilise un serial print de la valeur lue.
ca peut fluctuer de 10 lorsqu'il est au neutre.
une fois cette valeur définie, tu mets un autre else et LPWM_Output RPWM_Output à zéro
7
While I agree with the sentiment of this thread, BEWARE.
Microsoft have a well recorded history of hearing about 'standards' - not reading or understanding them, and hacking or misappropriating the terms and standard under their Microsoft, NET, or Windows brand umbrella.

They mean well, but some examples I found in media processing... GAIN, VOLUME, AMPLITUDE all mean something completely different in Windows Media than they did for the preceding 50 years in the rest of the world...!

Even worse - the teams that developed the WM encoders and decoders had zero communications with each other on different continents.
(This can be good for developing robust API documentation, but it sucks when you're rewriting a spoken language to do it.)
8
Hi, Thanks guys, it solved!

Code: [Select]
void displayWeather(float Temperature, String weatherDescription)
{   
    //Temperature
    char dest1[TEMPBUFSZ] = "  "; //set space in front for scroll
    char src1[TEMPBUFSZ]; //to store Temperature
    dtostrf(Temperature, 5, 2, src1); //convert float to char array
    strcat(dest1,src1); //concat dest1 and src1 "  99.99" to dest1
    strcat(dest1,"C"); //concat dest1 and "C" "  99.99C" to dest1
    unsigned char temp[TEMPBUFSZ] = "";  //create unsigned char array
    strcpy ((char*)temp, dest1); //convert char array dest1 to unsigned char array temp

    //weatherDescription
    char dest2[DESCBUFSZ] = "  "; //set space in front for scroll
    char src2[DESCBUFSZ]; //to store description
    weatherDescription.toCharArray(src2,DESCBUFSZ); //convert String to char array
    strcat(dest2,src2); //concat dest2 and src2 "  description" to dest2
    unsigned char desc[DESCBUFSZ] = "";  //create unsigned char array
    strcpy ((char*)desc, dest2); //convert char array dest2 to unsigned char array desc

    //Serial(57600)
    Serial.println(dest1);
    Serial.println(dest2);
   
    //display temperature
    ScrollingMsg.SetText((unsigned char *)temp, sizeof(temp) - 1);
    for(int x=0;x<((sizeof(temp))*6);x++)
    {
        if (ScrollingMsg.UpdateText() == -1)
          ScrollingMsg.SetText((unsigned char *)temp, sizeof(temp) - 1);
        else
          FastLED.show();
        delay(200);
    }

    //display description
    ScrollingMsg.SetText((unsigned char *)desc, sizeof(desc) - 1);
    for(int x=0;x<((sizeof(desc))*6);x++)
    {
        if (ScrollingMsg.UpdateText() == -1)
          ScrollingMsg.SetText((unsigned char *)desc, sizeof(desc) - 1);
        else
          FastLED.show();
        delay(200);
    }
}
9
Thanks for your quick response.

I guess I have a problem in the raw data.

I searched for it in the forum....I found that I have to remove the negative signs and I also read that the first number may be an occasional bug with Irremote when decoding in RAW mode.


10
I'm still learning to use arduino
i have a problem if i have a variable like this
int value = 300;
int value = 5;
float value = 6.5;

how i want to change the value through serial monitor and save it in eeprom, i have seen some examples but most values are in shaped array. where is the drawback of array if arduino reset the array data will be lost.
is there an example of how I created the program.

I try to refer to the example, but I can not apply on eeprom. i have been searching on google how but i do not understand
this is the example I tried.sorry my english

Code: [Select]
// simple parse demo
char receivedChars[] = "This is a test, 1234, 45.3" ;

char messageFromPC[32] = {0};
int integerFromPC = 0;
float floatFromPC = 0.0;

char recvChar;
char endMarker = '>';
boolean newData = false;


void setup() {
 Serial.begin(9600);
 Serial.println("<Arduino is ready>");
 
 parseData();
 showParsedData();
}


void loop() {

}

 
void parseData() {

    // split the data into its parts
   
  char * strtokIndx; // this is used by strtok() as an index
 
  strtokIndx = strtok(receivedChars,",");      // get the first part - the string
  strcpy(messageFromPC, strtokIndx); // copy it to messageFromPC
 
  strtokIndx = strtok(NULL, ","); // this continues where the previous call left off
  integerFromPC = atoi(strtokIndx);     // convert this part to an integer
 
  strtokIndx = strtok(NULL, ",");
  floatFromPC = atof(strtokIndx);     // convert this part to a float

}


void showParsedData() {
 Serial.print("Message ");
 Serial.println(messageFromPC);
 Serial.print("Integer ");
 Serial.println(integerFromPC);
 Serial.print("Float ");
 Serial.println(floatFromPC);
}


Pages: [1] 2 3 ... 10