Recent Posts

Pages: [1] 2 3 ... 10
1
Software / Re: ¿Existe en Arduino el conc...
Last post by ArduMyth - Today at 02:05 pm
Ya que estamos cómo se ha mencionado PORT, por si alguien quisiera saber cómo invertir los bytes pongo un ejemplo muy básico.

Code: [Select]

byte estados = B10010000;

void setup(){
  DDRD = B11111100;
}

void loop(){
  PORTD = estados = ~estados;
  delay(2000);
}
2
Project Guidance / Re: Need help in several thing...
Last post by Count - Today at 02:05 pm
Yes, that will work.
can you suggest which Library should I use? Will it be RS485 library or MODBUS RTU library? and how do I put it on WiFi?

I surfed the net and found MODBUS RTU library

https://github.com/jecrespo/simple-modbus

3
Sensors / Re: Urgent help needed!!! Trig...
Last post by AWOL - Today at 02:04 pm
Code: [Select]
int sensor_value = (4);
 

  if (sensor_value < 15)
In my experience, four is ALWAYS less than fifteen
4
Français / Re: Envoyer les données de plu...
Last post by xedprimo - Today at 02:02 pm
oui malheureusement.

5
Français / Re: Horloge Géante
Last post by lesept - Today at 02:02 pm
Trop compliqué pour moi. Voici ce que j'ai préparé :

Code: [Select]
#include "FastLED.h"
#define NUM_LEDS 60 // Nombre de LEDs par ligne
#define COLOR_ORDER BRG  // Color order
#define NumLignes 8
CRGB ligne0[NUM_LEDS]; // <-- C'est la ligne du haut !
CRGB ligne1[NUM_LEDS];
CRGB ligne2[NUM_LEDS];
CRGB ligne3[NUM_LEDS];
CRGB ligne4[NUM_LEDS];
CRGB ligne5[NUM_LEDS];
CRGB ligne6[NUM_LEDS];
CRGB ligne7[NUM_LEDS]; // Et la ligne du bas

char Message[101] = "Itaque tum Scaevola cum in eam ipsam mentionem incidisset, exposuit nobis sermonem Laeli de amicitia"; // Max 100 caractères à afficher
char Texte[NUM_LEDS]; // Le texte affiché à chaque instant
// On laisse un pixel entre chaque lettre affichée (ça peut être modifié)

#define PIXELS 6 // Nombre de pixels par lettre (yc un espace)
// A priori 7 lignes de LEDs suffisent avec cette définition
const uint8_t Font5x7[] PROGMEM = {
  0x00, 0x00, 0x00, 0x00, 0x00, //
  0x00, 0x00, 0xfa, 0x00, 0x00, // !
  0x00, 0xe0, 0x00, 0xe0, 0x00, // "
  0x28, 0xfe, 0x28, 0xfe, 0x28, // #
  0x24, 0x54, 0xfe, 0x54, 0x48, // $
  0xc4, 0xc8, 0x10, 0x26, 0x46, // %
  0x6c, 0x92, 0xaa, 0x44, 0x0a, // &
  0x00, 0xa0, 0xc0, 0x00, 0x00, // '
  0x00, 0x38, 0x44, 0x82, 0x00, // (
  0x00, 0x82, 0x44, 0x38, 0x00, // )
  0x10, 0x54, 0x38, 0x54, 0x10, // *
  0x10, 0x10, 0x7c, 0x10, 0x10, // +
  0x00, 0x0a, 0x0c, 0x00, 0x00, // ,
  0x10, 0x10, 0x10, 0x10, 0x10, // -
  0x00, 0x06, 0x06, 0x00, 0x00, // .
  0x04, 0x08, 0x10, 0x20, 0x40, // /
  0x7c, 0x8a, 0x92, 0xa2, 0x7c, // 0
  0x00, 0x42, 0xfe, 0x02, 0x00, // 1
  0x42, 0x86, 0x8a, 0x92, 0x62, // 2
  0x84, 0x82, 0xa2, 0xd2, 0x8c, // 3
  0x18, 0x28, 0x48, 0xfe, 0x08, // 4
  0xe4, 0xa2, 0xa2, 0xa2, 0x9c, // 5
  0x3c, 0x52, 0x92, 0x92, 0x0c, // 6
  0x80, 0x8e, 0x90, 0xa0, 0xc0, // 7
  0x6c, 0x92, 0x92, 0x92, 0x6c, // 8
  0x60, 0x92, 0x92, 0x94, 0x78, // 9
  0x00, 0x6c, 0x6c, 0x00, 0x00, // :
  0x00, 0x6a, 0x6c, 0x00, 0x00, // ;
  0x00, 0x10, 0x28, 0x44, 0x82, // <
  0x28, 0x28, 0x28, 0x28, 0x28, // =
  0x82, 0x44, 0x28, 0x10, 0x00, // >
  0x40, 0x80, 0x8a, 0x90, 0x60, // ?
  0x4c, 0x92, 0x9e, 0x82, 0x7c, // @
  0x7e, 0x88, 0x88, 0x88, 0x7e, // A
  0xfe, 0x92, 0x92, 0x92, 0x6c, // B
  0x7c, 0x82, 0x82, 0x82, 0x44, // C
  0xfe, 0x82, 0x82, 0x44, 0x38, // D
  0xfe, 0x92, 0x92, 0x92, 0x82, // E
  0xfe, 0x90, 0x90, 0x80, 0x80, // F
  0x7c, 0x82, 0x82, 0x8a, 0x4c, // G
  0xfe, 0x10, 0x10, 0x10, 0xfe, // H
  0x00, 0x82, 0xfe, 0x82, 0x00, // I
  0x04, 0x02, 0x82, 0xfc, 0x80, // J
  0xfe, 0x10, 0x28, 0x44, 0x82, // K
  0xfe, 0x02, 0x02, 0x02, 0x02, // L
  0xfe, 0x40, 0x20, 0x40, 0xfe, // M
  0xfe, 0x20, 0x10, 0x08, 0xfe, // N
  0x7c, 0x82, 0x82, 0x82, 0x7c, // O
  0xfe, 0x90, 0x90, 0x90, 0x60, // P
  0x7c, 0x82, 0x8a, 0x84, 0x7a, // Q
  0xfe, 0x90, 0x98, 0x94, 0x62, // R
  0x62, 0x92, 0x92, 0x92, 0x8c, // S
  0x80, 0x80, 0xfe, 0x80, 0x80, // T
  0xfc, 0x02, 0x02, 0x02, 0xfc, // U
  0xf8, 0x04, 0x02, 0x04, 0xf8, // V
  0xfe, 0x04, 0x18, 0x04, 0xfe, // W
  0xc6, 0x28, 0x10, 0x28, 0xc6, // X
  0xc0, 0x20, 0x1e, 0x20, 0xc0, // Y
  0x86, 0x8a, 0x92, 0xa2, 0xc2, // Z
  0x00, 0x00, 0xfe, 0x82, 0x82, // [
  0x40, 0x20, 0x10, 0x08, 0x04, // (backslash)
  0x82, 0x82, 0xfe, 0x00, 0x00, // ]
  0x20, 0x40, 0x80, 0x40, 0x20, // ^
  0x02, 0x02, 0x02, 0x02, 0x02, // _
  0x00, 0x80, 0x40, 0x20, 0x00, // `
  0x04, 0x2a, 0x2a, 0x2a, 0x1e, // a
  0xfe, 0x12, 0x22, 0x22, 0x1c, // b
  0x1c, 0x22, 0x22, 0x22, 0x04, // c
  0x1c, 0x22, 0x22, 0x12, 0xfe, // d
  0x1c, 0x2a, 0x2a, 0x2a, 0x18, // e
  0x10, 0x7e, 0x90, 0x80, 0x40, // f
  0x10, 0x28, 0x2a, 0x2a, 0x3c, // g
  0xfe, 0x10, 0x20, 0x20, 0x1e, // h
  0x00, 0x22, 0xbe, 0x02, 0x00, // i
  0x04, 0x02, 0x22, 0xbc, 0x00, // j
  0x00, 0xfe, 0x08, 0x14, 0x22, // k
  0x00, 0x82, 0xfe, 0x02, 0x00, // l
  0x3e, 0x20, 0x18, 0x20, 0x1e, // m
  0x3e, 0x10, 0x20, 0x20, 0x1e, // n
  0x1c, 0x22, 0x22, 0x22, 0x1c, // o
  0x3e, 0x28, 0x28, 0x28, 0x10, // p
  0x10, 0x28, 0x28, 0x18, 0x3e, // q
  0x3e, 0x10, 0x20, 0x20, 0x10, // r
  0x12, 0x2a, 0x2a, 0x2a, 0x04, // s
  0x20, 0xfc, 0x22, 0x02, 0x04, // t
  0x3c, 0x02, 0x02, 0x04, 0x3e, // u
  0x38, 0x04, 0x02, 0x04, 0x38, // v
  0x3c, 0x02, 0x0c, 0x02, 0x3c, // w
  0x22, 0x14, 0x08, 0x14, 0x22, // x
  0x30, 0x0a, 0x0a, 0x0a, 0x3c, // y
  0x22, 0x26, 0x2a, 0x32, 0x22, // z
  0x00, 0x10, 0x6c, 0x82, 0x00, // {
  0x00, 0x00, 0xfe, 0x00, 0x00, // |
  0x00, 0x82, 0x6c, 0x10, 0x00, // }
  0x10, 0x10, 0x54, 0x38, 0x10, // ~
  0x10, 0x38, 0x54, 0x10, 0x10, // 
};

void setup() {
  // Les pins de commande vont de 2 à 9
  LEDS.addLeds<WS2811, 2, COLOR_ORDER>(ligne0, NUM_LEDS);
  LEDS.addLeds<WS2811, 3, COLOR_ORDER>(ligne1, NUM_LEDS);
  LEDS.addLeds<WS2811, 4, COLOR_ORDER>(ligne2, NUM_LEDS);
  LEDS.addLeds<WS2811, 5, COLOR_ORDER>(ligne3, NUM_LEDS);
  LEDS.addLeds<WS2811, 6, COLOR_ORDER>(ligne4, NUM_LEDS);
  LEDS.addLeds<WS2811, 7, COLOR_ORDER>(ligne5, NUM_LEDS);
  LEDS.addLeds<WS2811, 8, COLOR_ORDER>(ligne6, NUM_LEDS);
  LEDS.addLeds<WS2811, 9, COLOR_ORDER>(ligne7, NUM_LEDS);
  LEDS.setBrightness(255);
}

void loop() {
  byte MessLength = sizeof(Message) * PIXELS;
  InitTexte();
  AfficheTexte();
  for (int i = NUM_LEDS + 1; i <= MessLength; i++) {
    DecaleTexte(i);
    AfficheTexte();
  }
}

void InitTexte() {
  // On met dans le texte à afficher les valeurs en hexa
  for (byte i = 0; i < NUM_LEDS; i++) {
    byte NumLettre = i / PIXELS;
    byte Numalpha = Message[NumLettre] - 32;
    byte indice = i % PIXELS; // Position du pixel dans le caractère
    if (indice == PIXELS - 1) Texte[i] = 0; // 1 espace en fin de caractère
    else Texte[i] = Font5x7[(PIXELS - 1) * Numalpha + indice];
  }
}

void DecaleTexte(int Pos) {
  // Décalage de 1 pixel vers la gauche
  for (byte i = 1; i < NUM_LEDS; i++) {
    Texte[i - 1] = Texte[i];
  }
  // Ajout du dernier pixel
  byte NumLettre = Pos / PIXELS + 1;
  byte NumAlpha = Message[NumLettre] - 32;
  byte indice = Pos % PIXELS; // Position du pixel dans le caractère
  if (indice == 0) Texte[NUM_LEDS] = 0;
  else Texte[NUM_LEDS] = Font5x7[(PIXELS - 1) * NumAlpha + indice];
}

void AfficheTexte() {
  int ledColor = 0x0000FF; // Color used (in hex)
  for (byte i = 0; i < NUM_LEDS; i++) {
    ligne0[i] = ledColor * (Texte[i] && 0x10000000);
    ligne1[i] = ledColor * (Texte[i] && 0x01000000);
    ligne2[i] = ledColor * (Texte[i] && 0x00100000);
    ligne3[i] = ledColor * (Texte[i] && 0x00010000);
    ligne4[i] = ledColor * (Texte[i] && 0x00001000);
    ligne5[i] = ledColor * (Texte[i] && 0x00000100);
    ligne6[i] = ledColor * (Texte[i] && 0x00000010);
    ligne7[i] = ledColor * (Texte[i] && 0x00000001);
  }
  FastLED.show();
  delay(500); // <-- Vitesse d'affichage (à ajuster)
}

Ça compile, mais sur un nano ça dit que la mémoire est faible. En effet, je déclare 8 tableaux de 60 couleurs pour les 8 lignes (mais 7 peuvent suffire je pense) et ça prend pas mal de place.

Tu testes ?
6
Deutsch / Re: Mp3 Jinglebox mit Rotary E...
Last post by Moko - Today at 02:02 pm
Ich hab den Code mal bei Pastebin hochgeladen
Und ich hab ihn hier angehangen. So ist nämlich die Chance, Hilfe zu bekommen, größer ;)

Code: [Select]
// Simple menu for LCD displays.
// Author: Reinhard Nickels 02.01.2012
// Selection of menu item with a rotary encoder (eg. http://www.pollin.de/shop/dt/Njg2OTU3OTk-/Bauelemente_Bauteile/Passive_Bauelemente/Potis_Trimmer_Encoder/Encoder_PANASONIC_EVEQDBRL416B.html)
// Rotary encoder example based on http://arduino.cc/forum/index.php/topic,62026.msg449681.html#msg449681 from Nick Gammon

// Wiring: Connect common pin of encoder to ground.
// Connect pin A (one of the outer ones) to a pin that can generate interrupts (eg. D2)
// Connect pin B (the other outer one) to another free pin (eg. D5)

// Code was developed for I2C LCD displays, selection should be done with #define I2CDISPLAY value.
// Debug with serial interface can be activated with define DEBUG

//#define DEBUG  
int dummy;    // this a workaround to avoid error messages with #define and #ifdef, see http://code.google.com/p/arduino/issues/detail?id=206
#define I2CDISPLAY
#define MAXLINES 2    // defines the number of display lines
#define LCD_CHARACTERS 16

#ifdef I2CDISPLAY

#include <SPI.h>  
#include <SdFat.h>
#include <SFEMP3Shield.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#define LCD_ADRESS 0x3F
LiquidCrystal_I2C lcd(LCD_ADRESS,LCD_CHARACTERS,MAXLINES);  // I2C LCD address is 0x27
#else
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);  // RS, E, D4, D5, D6, D7 - the standard connection
#endif

SdFat sd;       //SD Karte benennen
SFEMP3Shield MP3player;   //MP3 Shield als „MP3Player benennen

#define PINA 2
#define PINB 4
#define PUSHP 3
#define INTERRUPT 0  // that is, pin 2
#define INTERRUPTB 1  // that is, pin 3

volatile boolean turned;   // rotary was turned
volatile boolean fired;    // knob was pushed
volatile boolean up;  // true when turned cw

int CursorLine = 0;
int DisplayFirstLine = 0;
char* MenueLine[] = {"0. Track 1","1. Track 2","2. Track 3","3. Track 4","4. pre Bot Line","5. End"};
int MenueItems;

// Interrupt Service Routine for a change to pushpin
void isrp ()
{
  if (!digitalRead (PUSHP))
    fired = true;
}  // end of isr

// Interrupt Service Routine for a change to encoder pin A
void isr ()
{
  if (digitalRead (PINA))
    up = digitalRead (PINB);
  else
    up = !digitalRead (PINB);
  turned = true;
}  // end of isr


void setup ()
{
  if(!sd.begin(9, SPI_HALF_SPEED)) sd.initErrorHalt();  //SD Karte mit MP3 Dateien auslesen
  if (!sd.chdir("/")) sd.errorHalt("sd.chdir");

  MP3player.begin();    //MP3 Shield starten
  MP3player.setVolume(15,15); //Die Lautstärke einstellen
  
  digitalWrite (PINA, HIGH);     // enable pull-ups
  digitalWrite (PINB, HIGH);
  digitalWrite (PUSHP, HIGH);
  attachInterrupt (INTERRUPT, isr, CHANGE);   // interrupt 0 is pin 2
  attachInterrupt (INTERRUPTB, isrp, FALLING);   // interrupt 5 is pin 18
#ifdef I2CDISPLAY
  lcd.init();
  lcd.backlight();
#else
  lcd.begin(LCD_CHARACTERS, MAXLINES);
#endif
  lcd.setCursor(0,0);
  lcd.print("Testing Menue!");
  lcd.setCursor(0,1);
  lcd.print("SW Ver 1.0");
  delay(1500);
  MenueItems = sizeof(MenueLine)/sizeof(MenueLine[0]);
#ifdef DEBUG
  Serial.begin (9600);
  Serial.println("Testing Menue!........");
  Serial.print("Number of Menue Items ");
  Serial.println(MenueItems);
#endif
  lcd.clear();
  print_menue();
#ifdef I2CDISPLAY
  lcd.cursor_on();
#else
  lcd.cursor();
#endif
  lcd.blink();
}  // end of setup

void loop ()
{
  MP3player.available();
  if (turned)
    {
    if (up)
      move_up();
    else
      move_down();
    turned = false;
    }
  else if (fired)
    {
    selection();
    fired = false;
    }  // end if fired
}  // end of loop

void print_menue() {
  lcd.clear();
  for (int i=0;i<MAXLINES;i++) {
    lcd.setCursor(0,i);
    lcd.print(MenueLine[DisplayFirstLine + i]);
  }
  lcd.setCursor(0,(CursorLine-DisplayFirstLine));
}

void move_down() {
  if (CursorLine == (DisplayFirstLine+MAXLINES-1)) {
    DisplayFirstLine++;
  }
  if (CursorLine == (MenueItems-1)) {
    CursorLine = 0;
    DisplayFirstLine = 0;
  }
  else {
    CursorLine=CursorLine+1;
  }
  print_menue();
}

void move_up() {
  if ((DisplayFirstLine == 0) & (CursorLine == 0)) {
    DisplayFirstLine = MenueItems-MAXLINES;  
  }
  else if (DisplayFirstLine == CursorLine) {
    DisplayFirstLine--;
  }
  if (CursorLine == 0) {
    CursorLine = MenueItems-1;
  }
  else {
    CursorLine=CursorLine-1;
  }
  print_menue();
}

void selection() {
// integrate here your calls to selected sub (eg. with switch/case)
#ifdef DEBUG
  Serial.print("Menueline ");
  Serial.print(CursorLine);
  Serial.println(" selected");
  Serial.print("..this is Menuetext ");
  Serial.println(MenueLine[CursorLine]);
#endif
/* lcd.clear();
  lcd.print("You selected....");
  lcd.setCursor(0,1);
  lcd.print("Menue ");
  lcd.print(CursorLine);
  delay(1000); */
  switch (CursorLine) {
    case 0:
      track1();
      break;
    case 1:
      track2();
      break;
    case 2:
      track3();
      break;
    case 3:
      track4();
      break;
    default:
      break;
  }
  print_menue();
}

void track1() {
  lcd.clear();
  delay(100);
  MP3player.playTrack(1);
  lcd.print("Track 1");
  delay(1000);
}

void track2() {
  lcd.clear();
  delay(100);
  MP3player.playTrack(2);
  lcd.print("Track 2");
  delay(1000);
}

void track3() {
  lcd.clear();
  delay(100);
  MP3player.playTrack(3);
  lcd.print("Track 3");
  delay(1000);
}

void track4() {
  lcd.clear();
  delay(100);
  //MP3player.playTrack(4);
  lcd.print("Track 4");
  delay(1000);
}
7
Deutsch / ESP8266-01 kann nicht mehr gef...
Last post by FSD - Today at 02:01 pm
Hallo zusammen,

ich hoffe Ihr könnt mir helfen. Ich habe ein kleines bis mittel großes Problem. Ich kann meinen ESP8266-01 nicht mehr mit meinem FTDI232 flashen. Das komische ist, es geht erst seit kurzem nicht mehr und es geht bei allen nicht mehr(5 Module).

Ich habe alle Spannungen gemessen und keine geht über 3,3V. Laut der Arduino IDE kann er die zugänge nicht mehr öffnen.

warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed

Ich glaube ich hab alles versucht. Ich habe versucht die Firmware wieder zu flashen aber auch das ESP Flash Download Tool kommt nicht mehr auf die Module.
In der Arduino IDE habe ich alte Treiber runtergeladen aber auch die gehen nicht. Verstellt habe ich glaube ich auch nichts.

Ich wäre Euch super dankbar wenn mir einer helfen könnte.

Viele Grüße Felix
8
Project Guidance / Re: VHF signal Detector Using ...
Last post by MorganS - Today at 02:00 pm
That is a very wide band. That covers a lot of licenced users such as FM radio and aviation. There will always be many transmitters transmitting in that band.

Or is this for some kind of lab test where you plug in to the device instead of having an antenna?
9
Programming Questions / Re: Values displayes wrong on...
Last post by PaulS - Today at 01:57 pm
Solved it!

I sprinkled a few

if (x<10)
        {
          lcd.print("0");
        }

before the lcd.prints and that did the trick.
Instead of 5 lines of code EVERY place you need to print a number, create a function that prints the leading 0, if needed, and the number. Then, when you need to print a 2 digit number, use one line of code to call the function, instead of 5 lines.
10
Sensors / Re: Urgent help needed!!! Trig...
Last post by LIAM_MAD - Today at 01:57 pm
I've made some adjustments, Still the sensor is not working, the led won't turn off when the sensor is touched, apologies it's probably something minor I'm just not seeing.









Code: [Select]



const int sensorPin = 4;     // the number of the sensor pin
const int heatPin1 =  10;      // the number of the LED pin

int in = 2;
int out = 4;
int state = HIGH;
int r;
int p = LOW;

unsigned long time = 0;
unsigned long debounce = 200;


// variables will change:


void setup() {
  // initialize the LED pin as an output:
  pinMode(heatPin1, OUTPUT);


  // initialize the sensor pin as an input:
  pinMode(sensorPin, INPUT);
  pinMode(4, INPUT);
  pinMode(8, OUTPUT);
  digitalWrite(8, HIGH);
  Serial.begin(9600);


}

void loop() {
  // read the value from the sensor:
  //make sure pads are off
  Serial.println("I'm off, thanks.");
  int sensor_value = (4);
 

  if (sensor_value < 15) {
    // prints the value into the serial monitor
    Serial.print(sensor_value );
    // turn the LED on - this is just to show circuit is working
    digitalWrite(8, HIGH);
    // print to serial monitor
    Serial.println("-Light on");
    // turn the heatpad on
    digitalWrite(heatPin1, HIGH);
    // print to serial monitor
    Serial.println("-heat on");
    // delay for ease of reading
    delay(1000);
    r = digitalRead(4);
    if (r == HIGH && p == LOW && millis() - time > debounce) {
      if (state == HIGH)
        state = LOW;
      else
        state = HIGH;
      time = millis();
    }
    digitalWrite(8, state);



  }
  else {
    // turn the heating off
    digitalWrite(heatPin1, LOW);

  }
}[code]





[/code]
Pages: [1] 2 3 ... 10