Recent Posts

Pages: 1 [2] 3 4 ... 10
11
Deutsch / Re: Zeit am Arduino setzten
Last post by michael_x - Today at 04:16 pm
Mal zurück zur IRremote:

Wenn die IR Library sowieso schon drin ist und das LCD, macht die zusätzliche Funktion "RTC stellen" nicht so viel Zusatz-Aufwand.

Quote
bin jetzt schon bei 50% Programmspeicher
Vielleicht ist da schon viel Müll dabei ?

Ansonsten, die Github IRremote - IRrecvDemo braucht allein (nur mit Serial.print) 9.930 Bytes (30% eines atmega328)
Da kann man vermutlich durch Entfernen des Sendeteils und aller nicht benötigter Protokolle was sparen.

Quote
du musst sehr sparsam programmieren
Das ist ja grade der sportliche Aspekt daran.

Aber nur um ganz selten die RTC-Uhr zu stellen, ist evtl. eine Eingabe über Serial einfacher als ein 5 Taster - Keypad
12
True.
13
I'm not familiar with a "ps2 dual shock controller" but let me give you some info regarding the two boards. The Nano and Pro Mini both use the 328P chip but have to be selected correctly in the IDE before compiling. The Pro Mini has a definite negative in that there are numerous builders and mostly in China. I've seen three different versions of the pin layout and one with the programing header reversed. Just recently we found two with the wrong crystals installed. The Serial.begin() had to be set at twice the desired value to get them to communicate with the monitor. I would recommend staying with the Nanos as they all seem to work the same and eliminate the need for an FTDI adapter.
14
Microcontrollers / Re: MightyCore - ATmega8535/16...
Last post by hansibull - Today at 04:15 pm
What version of the core are you using? Manual install or boards manager URL?
If the speed is twice as fast, how are you able to upload your code using a USB to serial adapter? It sound like you're burnt the "8 MHz external" bootloader
15
Project Guidance / Re: Sensor voltage uplift for ...
Last post by Graynomad - Today at 04:15 pm
A voltage divider can never increase voltage, only reduce. The hint is in the name, it's a "divider" not a "multiplier" :)
16
Project Guidance / Re: HCSR04 codes
Last post by AWOL - Today at 04:15 pm
Quote
a second line display in my project
Using lcd.setCursor ?

Please remember to use code tags when posting code.

Code: [Select]
#define INTERVAL 300
void loop()
{
  if (millis()-lastPingTime>=INTERVAL) // trigger sensor every 100 milliseconds

Yeah, right.

Also, you've got two variables called "Level".
Don't do that, it's confusing.
17
Software / Re: ¿como cambiar la dirección...
Last post by cuchara - Today at 04:14 pm
Disculpen por las molestias  ya lo logre   :smiley-sweat:  :smiley-sweat:  :smiley-sweat:  :smiley-sweat:    :smiley-sweat:  :smiley-sweat:  :smiley-sweat:




Code: [Select]
/*
 Motor driver board MC338870
 
 Changes the speed and direction of rotation of a DC motor based on the
 input from a potentiometer.
 
 For schematics and info refer to here :https://chalmersphyscomp10.wordpress.com/2010/08/26/arduino-driving-a-motor-with-pololu-mc33887-motor-driver/
 http://chalmersphyscomp10.wordpress.com/2010/08/26/arduino-driving-a-motor-with-pololu-mc33887-motor-driver/
 
 The code is written by Farshid Jafari Harandi,
 (C) Spekel, Spekel.se
 
 */
int Revers =5;
int ledPin =  13;    // LED connected to digital pin 13
int pwmPin = 11;     // PWM Motor driver (/D2 pin pin on MC338870 motor board)
int motorPin1 = 7;   // Motor pin 1 (IN1 on MC338870 motor board)
int motorPin2 = 8;   // Motor pin 2 (IN2 on MC338870 motor board)
int pot = 0;        // Potentiometer pin on analog input 0
                    //Leave D1 and /FS and /FB unconnceted
                    //Connect the EN to +5V on Arduino board
int val;
// The setup() method runs once, when the sketch starts

 void setup()   {         
  pinMode(Revers, INPUT);       
  pinMode(ledPin, OUTPUT); // initialize the digital pin as an output:
  pinMode(pwmPin, OUTPUT); // initialize the digital pin as an output:
  pinMode(motorPin1, OUTPUT); // initialize the digital pin as an output:
  pinMode(motorPin2, OUTPUT); // initialize the digital pin as an output:
  digitalWrite(Revers,HIGH);
   
   Serial.begin(9600);
}

// the loop() method runs over and over again,
// as long as the Arduino has power

void loop()                     
{
 //read the serial port
 val = analogRead(pot);
 val = map(val,0,1023,-255,255);
 Serial.println(val);
 
  if (digitalRead (Revers)== HIGH){
 if (val >= 0)
 
     {
  digitalWrite(ledPin,HIGH);
    digitalWrite(motorPin1,LOW);
    digitalWrite(motorPin2,HIGH);
    analogWrite(pwmPin,val);
     }
   else
   {
    val *= -1;
    digitalWrite(ledPin,LOW);
    digitalWrite(motorPin1,HIGH);
    digitalWrite(motorPin2,LOW);
    analogWrite(pwmPin,val);
   }
  }
  if (digitalRead (Revers)== LOW)
 
  {
   if (val >= 0)
 
 {
  digitalWrite(ledPin,HIGH);
    digitalWrite(motorPin1,HIGH);
    digitalWrite(motorPin2,LOW);
    analogWrite(pwmPin,val);
   }
   else
   {
    val *= -1;
    digitalWrite(ledPin,LOW);
    digitalWrite(motorPin1,LOW);
    digitalWrite(motorPin2,HIGH);
    analogWrite(pwmPin,val);
   }
 
  }
   
   delay(100);

 
   
}
18
You can fix the hardware mistake in software. If the outputs are all PWM pins, you can use analogWrite() to makwers the tail light.
19
You are making it way too complicated. Making my head spin.  :smiley-roll:

http://www.robotshop.com/en/rs232-shield-arduino.html
20
Français / Re: Creation de fichier
Last post by eeaeea - Today at 04:13 pm
Merci pour ta réponse !
La variable mesure est modifée dans le code mais je n'ai pas fais apparaitre cette partie, j'ai le meme soucis pour un tableau de string, je n'arrive pas a ecrire le contenu des cases dans le fichier. Ces variables sont globales, cela ne pourrait pas venir de la pour je ne sais quelle raison ?

J'ai un soucis avec la RTC, je l'ai initialisée à l'aide de ce programme et elle m'affiche bien l'heure actuelle :


Code: [Select]
// Date and time functions using a DS1307 RTC connected via I2C and Wire lib
#include <Wire.h>
#include "RTClib.h"

#if defined(ARDUINO_ARCH_SAMD)
// for Zero, output on USB Serial console, remove line below if using programming port to program the Zero!
   #define Serial SerialUSB
#endif

RTC_DS1307 rtc;

char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};

void setup () {

#ifndef ESP8266
  while (!Serial); // for Leonardo/Micro/Zero
#endif

  Serial.begin(57600);
  if (! rtc.begin()) {
    Serial.println("Couldn't find RTC");
    while (1);
  }

  if (! rtc.isrunning()) {
    Serial.println("RTC is NOT running!");
    // following line sets the RTC to the date & time this sketch was compiled
   // rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
    // This line sets the RTC with an explicit date & time, for example to set
    // January 21, 2014 at 3am you would call:
    // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
  }
}

void loop () {
    DateTime now = rtc.now();
   
    Serial.print(now.year(), DEC);
    Serial.print('/');
    Serial.print(now.month(), DEC);
    Serial.print('/');
    Serial.print(now.day(), DEC);
    Serial.print(" (");
    Serial.print(daysOfTheWeek[now.dayOfTheWeek()]);
    Serial.print(") ");
    Serial.print(now.hour(), DEC);
    Serial.print(':');
    Serial.print(now.minute(), DEC);
    Serial.print(':');
    Serial.print(now.second(), DEC);
    Serial.println();




Mais lorsque j'enregistre la date dans un fichier j'obtiens ceci :  Date :  165/165/2165   165:165:85

Code :

   
Code: [Select]
DateTime now = rtc.now();
   SDfile.print(now.day(), DEC);
   SDfile.print('/');
   SDfile.print(now.month(), DEC);
   SDfile.print('/');
   SDfile.print(now.year(), DEC);
   SDfile.print("   ");
   SDfile.print(now.hour(), DEC);
   SDfile.print(':');
   SDfile.print(now.minute(), DEC);
   SDfile.print(':');
   SDfile.print(now.second(), DEC);
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