Recent Posts

Pages: [1] 2 3 ... 10
1
I just tested it, it starts exactly at the time, but does not stop after the first run as commanded!
I added
boolean runMotor =false; just before Void setup (){
and added the code you proposed...but it's like the motor does not stop until the minute is over.
Code: [Select]
#include <Wire.h>
#include "RTClib.h"
#include <AFMotor.h>

RTC_DS1307 rtc;

AF_Stepper motor (200, 2); // it's a stepper motor 1.8deg, 200 steps for 360degrees and is connected to M3 and M4

int hr;
int mi;


int fh1 = 13; // 10
int fm1 = 43; // 00


int fh2 =12;
int fm2 =48;


int fh3=12;
int fm3=07;
int sec3=01;

boolean runMotor =false;
void setup() {
 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));
  }
  motor.setSpeed(50);
}

void loop()
{
  DateTime now = rtc.now();
  hr=now.hour();
  mi=now.minute();
 
 
  Serial.print(now.hour(), DEC);
  Serial.print(':');
  Serial.print(now.minute(), DEC);
  Serial.print(':');

 
  Serial.println();

  if (hr == fh1 && mi == fm1 && runMotor ==false)
  { runMotor =true;
  }
  if (runMotor)
  {motor.step(800, BACKWARD, SINGLE);
      delay(1000);
      motor.step(200, FORWARD, SINGLE);
      delay(1000);
      runMotor= false;
     
  }
}


and I realized that the stepper is doing weird stuff also with the simpler sketch too, sometimes it does rotates exactly , but kind of forgot what is forward or backward after. I wonder if my wiring is good: I attached in order yellow, red, green, gray to M3 and M4 of the motor shield board.....that's really weird
2
So, first the code
3
Project Guidance / Re: How to wire my home automa...
Last post by PaulRB - Today at 08:45 pm
You could try using these amazing but tiny and very inexpensive components. I put one at the end of that last sentence. They are called full stops. They will prevent people like me passing out from lack of oxygen before reaching the end of your sentences!
4
Deutsch / Re: Hilfe beim Anschluß von 3,...
Last post by zyxel1496e - Today at 08:44 pm
[/URL][/img]

Ich hoffe nun ist ein Bild zu sehen. ich verwende einen Mega.
5
Français / Re: programme arduino bluetoot...
Last post by J-M-L - Today at 08:44 pm
Quels sont vos modules BT?
Comment sont connectées les pin 8 et 9?
Quid de l'alimentation?
avez vous des modules 5V?

Sinon merci de lire comment utiliser le forum --> ce que veut dire Icare c'est :

corrigez votre post ci dessus et rajoutez les code tags autour du code:
[code] // votre code ici [/code].

ça doit ressembler à cela:
Code: [Select]
// votre code ici
(faites aussi ctrl-T (PC) or cmd-T (Mac) dans l'IDE avant de copier le code pour qu'il soit indenté correctement)


6
Deutsch / Re: Lüftersteuerung mit DHT22,...
Last post by HotSystems - Today at 08:43 pm
Nimm einen BC337-40 dafür, das passt.
Wenn der Transistor komplett durchschaltet, dann ist in dem Fall Ptot eher unkritisch.
7
I installed ESP8266 Core 2.4-RC1 and it compiled... onto next stage :)
8
I edited a program (not very great, but it works) the only thing is only thing is i cant get The light and the servo to work in sync ( i made 2 functions "showSpectrum" and "servoTest") the code is below can anyone assist me, its for a school project i was assigned to.


Code: [Select]



const int RED_PIN = 6;
const int GREEN_PIN = 5;
const int BLUE_PIN = 3;

int DISPLAY_TIME = 100;  
#include <Servo.h>  // servo library


Servo servo1;  // servo control object



void setup()
{

 servo1.attach(9);
 pinMode(RED_PIN, OUTPUT);
 pinMode(GREEN_PIN, OUTPUT);
 pinMode(BLUE_PIN, OUTPUT);
 
}


//==========================
// This is where i need help VVV
//how can i get both of these things to happen at the same time,
//what it does now is it will go through the spectrum of colours for the light then it will
//activate the servo, when the servo is done doing its rotations the rgb light changes colour again

void loop()
{
 showSpectrum();
 servoTest();



//^^^^^^^^^^^^^^^^^^^^^^^^^

 
}

void showSpectrum()
{
 int x;
  for (x = 0; x < 768; x++)
 {
   showRGB(x);  // Call RGBspectrum() with our new x
   delay(10);   // Delay for 10 ms (1/100th of a second)
 }
}

// showRGB()
// This function translates a number between 0 and 767 into a
// specific color on the RGB LED. If you have this number count
// through the whole range (0 to 767), the LED will smoothly
// change color through the entire spectrum.

// The "base" numbers are:
// 0   = pure red
// 255 = pure green
// 511 = pure blue
// 767 = pure red (again)

// Numbers between the above colors will create blends. For
// example, 640 is midway between 512 (pure blue) and 767
// (pure red). It will give you a 50/50 mix of blue and red,
// resulting in purple.

// If you count up from 0 to 767 and pass that number to this
// function, the LED will smoothly fade between all the colors.
// (Because it starts and ends on pure red, you can start over
// at 0 without any break in the spectrum).

void showRGB(int color)
{
 int redIntensity;
 int greenIntensity;
 int blueIntensity;

// Here we'll use an "if / else" statement to determine which
  // of the three (R,G,B) zones x falls into. Each of these zones
  // spans 255 because analogWrite() wants a number from 0 to 255.

  // In each of these zones, we'll calculate the brightness
  // for each of the red, green, and blue LEDs within the RGB LED.



 if (color <= 255)          // zone 1
 {
   redIntensity = 255 - color;    // red goes from on to off
   greenIntensity = color;        // green goes from off to on
   blueIntensity = 0;             // blue is always off
 }
 else if (color <= 511)     // zone 2
 {
   redIntensity = 0;                     // red is always off
   greenIntensity = 255 - (color - 256); // green on to off
   blueIntensity = (color - 256);        // blue off to on
 }
 else // color >= 512       // zone 3
 {
   redIntensity = (color - 512);         // red off to on
   greenIntensity = 0;                   // green is always off
   blueIntensity = 255 - (color - 512);  // blue on to off
 }

 analogWrite(RED_PIN, redIntensity);
 analogWrite(BLUE_PIN, blueIntensity);
 analogWrite(GREEN_PIN, greenIntensity);
}


// To slow down the servo's motion, we'll use a for() loop
  // to give it a bunch of intermediate positions, with 20ms
  // delays between them. You can change the step size to make
  // the servo slow down or speed up. Note that the servo can't
  // move faster than its full speed, and you won't be able
  // to update it any faster than every 20ms.

  // Tell servo to go to 180 degrees, stepping by two degrees




void servoTest()
{
 int position;
 

 for(position = 0; position < 180; position += 2)
 {
   servo1.write(position);  // Move to next position
   delay(20);               // Short pause to allow it to move
 }

 // Tell servo to go to 0 degrees, stepping by one degree

 for(position = 180; position >= 0; position -= 1)
 {                                
   servo1.write(position);  // Move to next position
   delay(20);               // Short pause to allow it to move
 }
}

9
Deutsch / Re: Neopixel Uhr
Last post by Mickat1427 - Today at 08:43 pm
Vielen Dank für die Hilfe von euch. Werde es mal testen und dann Bescheid geben.


Wäre es noch hilfreich ein Pegelwandler zwischen den Wemos und den Neopixel zu hängen ?

Mfg Micha
10
Exhibition / Gallery / Custom character generator for...
Last post by kake - Today at 08:41 pm
Hi guys!

I've made a custom character(glyph) generator for HD44780 LCD modules.
It was inspired by Omerk's custom character generator, wich can be visited here.
The differences are that my version supports creating more than one glyph at a time and it has a more modern design.

It can be visited at http://kakedev.github.io/GlyphGenerator
The source code is available at http://www.github.com/kakedev/GlyphGenerator
Pages: [1] 2 3 ... 10