Recent Posts

Pages: [1] 2 3 ... 10
1
Programming Questions / Data type for Boolean logic
Last post by Esrah - Today at 03:23 am
I have a while loop that I can't figure out how to exit from correctly, and I think it's because of a data type conflict. When I use my lcd screen to print species, it shows the correct number based on what key I've pressed on the keypad. However, pressing - for example - 1 or 2 does not cause the while loop to exit correctly. Any insight on why would be appreciated.



char species = 0;

void loop() {

while (species == 0) {
      lcd.setCursor(0,0);
      lcd.print("Select Species  ");
      char species = kpd.getKey();
      unsigned long currentMillis = millis();
      delay(1000);
      lcd.clear();
      lcd.print(species);
      delay(1000);
      /*
      if (currentMillis - previousMillis >= interval & trip == 0) {
        lcd.setCursor(0,1);
        lcd.print("1 Oyster        ");
        trip = 1;
        previousMillis = currentMillis;
        }

      if (currentMillis - previousMillis >= interval & trip == 1) {
        lcd.setCursor(0,1);
        lcd.print("2 Shiitake      ");
        trip = 0;
        previousMillis = currentMillis;
        }
      */
       }

}
2
Displays / Re: Wiring up an LCD
Last post by beartech - Today at 03:13 am
fyi Phoenix Enterprises (phoenixent) has a new website peconnectors.com

Male IDC Connectors are here now
https://www.peconnectors.com/male-idc-headers-plugs-.100/

Direct link to HWS10267 is here
https://www.peconnectors.com/male-idc-headers-plugs-.100/hws10267/

Flat Ribbon Cable is here now
https://www.peconnectors.com/wire-and-cable-bulk/
3
Programming Questions / no idea what im doing
Last post by bennbighead - Today at 03:07 am
hi yes I'm getting this error message for my code

I'm sorry if I posted this coder wrong this is my first time using the Arduino and this is also my first time working on an Arduino project so please bear with me

this is my code #include <fauxmoESP.h>
#include <AsyncPrinter.h>
#include <async_config.h>
#include <ESPAsyncTCP.h>
#include <ESPAsyncTCPbuffer.h>
#include <SyncClient.h>
#include <tcp_axtls.h>
#include <dummy.h>
 #include <Arduino.h>
#include <ESP8266WiFi.h>
#include "fauxmoESP.h"
#include <Servo.h>

/* Network credentials */
#define WIFI_SSID "*********"
#define WIFI_PASS "*********"

#define SERIAL_BAUDRATE 115200  //this is important to set in the Arduino IDE
bool resetMe=false;
int beginVal=0;

/* Belkin WeMo emulation */
fauxmoESP fauxmo;
Servo myservo;  // create servo object to control a servo

void setup()
{
   Serial.begin(SERIAL_BAUDRATE);
   //setup and wifi connection
   wifiSetup();
    pinMode(D4, OUTPUT);
    myservo.attach(2);
    beginVal = myservo.read();
   // Device Names for Simulated Wemo switches
   fauxmo.addDevice("finger");
   fauxmo.onMessage(callback);
}

void loop()
{
  if(resetMe){
    delay(1000);
    Serial.println("reset the servo");
    myservo.write(0);
    resetMe=false;
  }
  fauxmo.handle();
}

/* ---------------------------------------------------------------------------
 Device Callback
 ----------------------------------------------------------------------------*/
void callback(uint8_t device_id, const char * device_name, bool state)
{
  Serial.print("Device "); Serial.print(device_name);
  Serial.print(" state: ");
  if (state)
  {
    Serial.println("ON");
  }
  else
  {
    Serial.println("OFF");
  }
 
  //Switching action on detection of device name, useful for adding
  //multiple "devices" to a single ESP unit.
 
  if ( (strcmp(device_name, "finger") == 0) )
  {
    if (state)
    {
      int newVal = beginVal+15;
      myservo.write(newVal);
      resetMe=true;
      Serial.println("ok"); 
    } else{
      myservo.write(beginVal);
    }
 
  }
 
}

void moveServo(int val){
  Serial.println("moveServo");
    //if you need to scale from a potentiometer to use it with the servo (value between 0 and 180)
    //val = map(val, 0, 1023, 0, 180);     
    myservo.write(val);
}

/* -----------------------------------------------------------------------------
 Wifi Setup
 -----------------------------------------------------------------------------*/
void wifiSetup()
{
   // Set WIFI module to STA mode
   WiFi.mode(WIFI_STA);

   // Connect
   Serial.println ();
   Serial.printf("[WIFI] Connecting to %s ", WIFI_SSID);
   Serial.println();
   WiFi.begin(WIFI_SSID, WIFI_PASS);

   // Wait
   while (WiFi.status() != WL_CONNECTED)
   {
      Serial.print(".");
      delay(100);
   }
   Serial.print(" ==> CONNECTED!" );
   Serial.println();

   // Connected!
   Serial.printf("[WIFI] STATION Mode, SSID: %s, IP address: %s\n", WiFi.SSID().c_str(), WiFi.localIP().toString().c_str());
   Serial.println();
'}'
4
Programming Questions / Re: HTML Question
Last post by CurtCarpenter - Today at 03:07 am
Thank you very much!  I think I can make some progress now :)
5
Hi,
I recently had some shields made and a problem I have with them is that their male header pins bend when I separate the shield from the Arduino. They are too soft.  Any suggestions on what material the header pins should be made of so that they do not bend so easily? Brass/Bronze/Titanium etc.
As somebody mentioned already....... it's usually necessary to slowly separate the shield from the arduino .... such as to apply a tiny bit of separation on one end to begin with.....then work on the other side (to get some separation, but not full separation). And keep repeating these steps in stages. Eventually, the shield and arduino can be separated without pins getting bent.

What you're probably doing right now is using force to just rip the two sides apart. That will certainly bend pins. Here, I'm talking about UNO pins.

I know that shields for larger boards with lots of pins..... like Arduino MEGA can be a real pain to couple together, due to pin misalignment. Separating is no problem though.
6
General Electronics / Re: Wire suggestion needed
Last post by beartech - Today at 03:05 am
fyi: Phoenix Enterprises (phoenixent) has a new website peconnectors.com

Wire Wrap sockets and Wire are here now
https://www.peconnectors.com/sockets-wire-wrap/

HWS15996
HWS1647
HWS16030
can be found directly on these pages
https://www.peconnectors.com/sockets-wire-wrap/hws15996/
https://www.peconnectors.com/pin-headers-straight-2x-row-.100/hws1647/
https://www.peconnectors.com/sockets-wire-wrap/hws16030/
7
I am using an arduino uno + mp3 mini dfplayer to turn an old radio into a jukebox.

I found most of the stuff i need in the "DFRobotDFPlayerMini.h" library, except for an easy way to change folders. I want to assign a button to "next folder" and one to "previous folder". I only found "void playMp3Folder(int fileNumber);" so i'll have to find a way around it.

I'm thinking of using SwitchCase and make a case to play each folder, or create a function for each folder but i have no idea how to call it.

Any ideas?
8
Project Guidance / Programming Complex Sequential...
Last post by bobledoux - Today at 03:02 am
I'm a hobby programmer 6 months using Arduino after ten years of working Microchip PIC in assembler.

I'm looking for input on how to approach projects more complex than a simple void loop().

 I'm working on a maze solving robot performs three tasks:

the maze is black tape on white board. 

The first task is to solve the maze.  The robot is placed somewhere on the board and travels until the goal is reach.  Every time the robot passes over a maze junction it saves its decision in a character string.  The decisions include, turn right (R), turn left (L), go straight (S), turn around at a dead end (B).

The second task is to simplify the course.  An algorithm takes the course character stream and removes all dead ends or other unnecessary turns.

The third task is to run the same course in the most efficient manner.  The robot is placed back at its starting point. Each time it passes over a maze junction it performs the next decision based on the next optimized string character.

At the end of the last task the robot should come to a stop.  I'm using a long delay statement.

Each of these tasks involves its own set of primary and secondary functions.

My current approach has been to leave the current task by calling the next.  This method should result in the program never returning to the first step of void loop function.  But it is going back before completing the last task.


Where do I find theory or approaches for such sequential programs?
9
fyi: Phoenix Enterprises (phoenixent) has a new website peconnectors.com

The category pages for square pin male pin headers and machined headers & sip sockets are here now:

https://www.peconnectors.com/male-pin-headers-breakaway/

https://www.peconnectors.com/machined-headers-sip-sockets/
10
Quote
The three last actions (second LED on and measurements on PD) must be simultaneous
"Simultaneous" is not possible under any circumstance.

What are your actual  requirements in terms of event timing?
Pages: [1] 2 3 ... 10