Pages: 1 ... 6 7 [8] 9 10
 71 
 on: Today at 07:46:33 am 
Started by ewen - Last post by PaulRB
My bad, I said TPIC6C595 when I meant TPIC6A595, which is the data sheet I linked to.

So the peak current is 1.1A for a single output, not 500mA, but as GM says, that is for <100us. Your solenoid will probably hit its peak current for a moment but probably still too long.

Apologies ewen, back to your FET hunting...

 72 
 on: Today at 07:46:04 am 
Started by nando88 - Last post by PaulS
Quote
Can someone please tell me how to do this?
I have a bank of phones. I only want to answer the phone if it is my friend Joe calling. How can I do that?

You can't. You have to know that the Arduino is connected to the port you are opening, or you have to open the port and ask if the Arduino is on the other end. Of course, in order to do that, the Arduino must be expecting the question, and provide the appropriate answer AND any other application already on the port can not be disturbed by your intrusion on the port.

 73 
 on: Today at 07:44:38 am 
Started by Barcors - Last post by Barcors
I have started Arduino based aquarium controller. At the moment I got stuck with the time controlled outputs. I am sorry for my English but I'll try to explain.
I am working on Arduino PRO MINI.  Also using Tiny RTC DS1307 and  I2C 20x4 LCD booth on the same I2C line. For RTC I am using RTClib.h librarry. Dallas temperature sensor, DH11. Everything is working good but time control. I have time on display, I can adjust time by 3 buttons.
I want to control aquarium light, air pump, 2 filters by time. For instance: I want that aquarium lights could light on right on 7.30  and turns off on 21.30. Nearly the same with other stuff (filters, air etc.) The important thing is that after power failure during ON time (day time) controller should turn on light again when power comes on again.

Here is part of my code for time controller:

Code:
//define
unsigned int LightStartHr = 7; // light on hour
unsigned int LightStartMin = 30; // light on minute

unsigned int LightEndHr = 21; // light off hour
unsigned int LightEndMin = 30; // light of minute

void loop()
   {
      if ((hours >= LightStartHr && minutes >= LightStartMin) && (hours <= LightEndHr && minutes < LightEndMin))
      {
        // turn on light
        lcd.setCursor(0, 3);
        digitalWrite(LightLED, HIGH);
        digitalWrite(NightLED, LOW);
        lcd.print("Day ");
     
      }
    else
    {
     
   // turn off light
        lcd.setCursor(0, 3);
        digitalWrite(LightLED, LOW);
        digitalWrite(NightLED, HIGH);
        lcd.print("Night");
      } 
    }


I hope this helps you to understand what I want and figure out my mistake.
I must tell you that if I remove minutes and stay with only hours - everything is working fine. Light is turning on in round about hour set.  The same if I remove hour and stay only with minutes. How to force controlling with booth hour and minute:  "if ((hours >= LightStartHr && minutes >= LightStartMin) && (hours <= LightEndHr && minutes < LightEndMin))"
I am not good in Arduino programming  smiley-confuse so I need support here.
By the way I have searched a lot unsuccessfully. A lot of examples are based on mills. They counting time from midnight. This is not good for me. I want control outputs by 24H time. Thanks.

 74 
 on: Today at 07:44:17 am 
Started by JeroenRood - Last post by JeroenRood
Ok, thanks! I see what you mean. I will update my code, as soon as I find some time.

 75 
 on: Today at 07:44:10 am 
Started by jl-p - Last post by jl-p
I have a 7"display but the only examples i find are pic examples (i think)
I ported the SPI version for the display already from that to arduino and that works as expected.

But now i'm busy with the I2C code so i can choose which connection i want. and make a library for it.
I don't know if its necessary but i will use it on my due

but i have a couple of Wire issues i'm not sure off.

I think the only functions which needs to be corrected are the
master_ACK
slave_ACK
IIC_WriteByte
IIC_ReadByte

so i think start en stop voids can be removed
Start() and stop()  changed for Wire.beginTransmission(); and Wire.endTransmission();
 




Code:
sbit  MCU_RST=P2^3;
sbit  SCL=P1^1;
sbit  SDA=P1^0;
sbit next =P2^7; //next
bit ack;

#define write_data_addr  0x0c  //slave addresses with write data
#define read_data_addr  0x0d  //slave addresses with write data
#define write_cmd_addr  0x0e  //slave addresses with write command
#define read_cmd_addr  0x0f  //slave addresses with read status


//I2C_Init()
void SPI_Init(void)
{
// SCL = 1;
// SDA = 1;
        wire.begin();    //         i think only this line instead of the two above
}


//start
void start(void)
{
SDA=1;
delay(1);
SCL=1;
delay(1);
SDA=0;
delay(1);
SCL=0;
delay(1);

 }

 //stop
 void stop(void)
 {
SDA=0;
delay(1);
SCL=1;
delay(1);
SDA=1;
delay(1);
SCL=0;
delay(1);

  }
 
//Host sends an ACK
//ack=0  ACKNOWLEDGE  ack=1 NOT ACKNOWLEDGE
void master_ACK(bit acknow)
{ SDA=acknow;
delay(1);
SCL=1;
delay(1);
SCL=0;
delay(1);
}



//Slave sends ACK
void slave_ACK(void)
{uchar i=0;
delay(1);
SDA=1;
delay(1);
SCL=1;
delay(1);
while((SDA==1)&&i<200)i++;
delay(1);
SCL=0;
delay(1);
}


//*********I2C send byte
void IIC_WriteByte(uchar Byte)
{uchar t;
for(t=0;t<8;t++)
  { delay(1);
    SDA=(bit)(Byte & 0x80) ;
    Byte <<=1;
delay(1);
    SCL=1;
delay(1);
    SCL=0;
delay(1);

    }
slave_ACK();
}

//*********I2C Read byte
uchar IIC_ReadByte(void)
{uchar t,read_data=0;
SCL=0;
delay(1);
SDA=1;
delay(1);
for(t = 0; t < 8; t++)
{ delay(1);
SCL = 1;
delay(1);
read_data<<=1;
if(SDA == 1)
read_data=read_data|0x01;
SCL=0;
}

master_ACK(ack);

return read_data;
}

void LCD_CmdWrite(uchar cmd)
{
Wire.beginTransmission();
IIC_WriteByte(0x0e);
IIC_WriteByte(cmd);
Wire.endTransmission();
}


//////////////SPI Write data or  parameter
void LCD_DataWrite(uchar Data)
{
Wire.beginTransmission();
IIC_WriteByte(0x0c);
IIC_WriteByte(Data);
Wire.endTransmission();
}

///////////////Read data or  parameter
uchar LCD_DataRead(void)
{
uchar Data;

Wire.beginTransmission();
IIC_WriteByte(0x0d);
ack=1;
Data=IIC_ReadByte();
Wire.endTransmission();

return Data;




///////////SPI Read  status
uchar LCD_StatusRead(void)
{
uchar Data;

Wire.beginTransmission();
IIC_WriteByte(0x0f);
ack=1;
Data=IIC_ReadByte();
Wire.endTransmission();

return Data;
}


Already Thanks

Johan

 76 
 on: Today at 07:40:47 am 
Started by Northof49 - Last post by wildbill
Quote
Is there any difference between me having put the web server code in a function, and calling up the function in the main loop

Not really and it makes your code cleaner. There is overhead associated with calling a function but it's negligible. If you get to the point where that overhead is a problem, there's always the 'inline' directive to get the best of both worlds.

 77 
 on: Today at 07:38:30 am 
Started by pa4mic - Last post by pa4mic
Hallo allemaal,

ik ben wat aan het spelen met de tone functie maar ik heb een probleem wat ik niet helemaal snap namelijk: in sommige gevallen is de frequentie van gekozen toon veel groter dan ingesteld en gekke is dat de stappen hierin niet lineair lopen. enkele voorbeelden:

ingesteld op 878hz geeft 880,992
ingesteld op 879hz geeft 880,996hz
ingesteld op 880hz geeft 880,999hz
ingesteld op 881hz geeft 887,2hz

Zoals je ziet springt hij dus bij 1 hz hoger instellen op 6hz hoger uit, ik begrijp niet zo goed hoe dit kan en waar ik die zou kunnen herstellen of ondervangen.

De bedoeling is dat ik op de uitgang weer een 10deler gebruik om uit eindelijk halve hz tonen over te houden waar ik weer verder mee kan. (tone functie kent geen halve hz vandaar)

iemand enig idee waar ik het moet zoeken of er aan kan doen?

 78 
 on: Today at 07:37:41 am 
Started by deagon - Last post by deagon
Salve a tutti!! nonostante le feste lo smanettone che è in me nn va in vacanza  smiley-evil
volevo chiedervi un' informazione.... siccome mi sono cimentato nella realizzazione di un circuitino banalissimo ovvero quell fatto con il transistor tip31 per far lampeggiare i led a ritmo di musica, però giustamente quand iserisco il jack dentro alla presa delle cuffie del pc la canzone giustamente non si sente lasciando spazio al lampeggio psikedelico dei led  smiley-twist
Ma vorrei sapere una cosa... dato che ho una cassa vorrei sia ascoltare la musica da essa che apprezzare i lampeggi però non so dove collegarla esattamente perchè l' ho messa tra l' ingresso della base del transistor e la massa ma con lo scarso risultato che funziona lo speacker ma non piu' i led.... qualkuno di voi potrebbe illuminarmi???  ecco schema

 79 
 on: Today at 07:31:40 am 
Started by Jean-no - Last post by johnwasser
To connect a USB peripheral to an Arduino you need something like a USB Host Shield.

 80 
 on: Today at 07:30:35 am 
Started by emjay - Last post by emjay
nach langen probieren habe ich diesen Code geschrieben und meines Erachtens funktioniert er auch. Oder ist das eher Zufall??
der eigentliche Sensorwert (mit dem dann weitergearbeitet wird), soll nur dann angezeigt werden, wenn delta <= 1 ist.

Code:
int currVal;
int prevVal;
int delta;
int Sensorwert;

void setup(){
  Serial.begin(9600);                 
}

void loop(){                         
  prevVal = analogRead(A0);   
  Serial.println("prevVal ");
  Serial.print(prevVal);
  Serial.println();
 
  delay(5000);
 
  currVal = analogRead(A0);
  Serial.println("currVal ");
  Serial.print(currVal);
  Serial.println();
 
  delta = (currVal-prevVal);
  Serial.println("Delta ");
  Serial.print(delta);
  Serial.println();
 
 
  if(abs(currVal-prevVal)<= 1){
    Sensorwert = currVal;
    Serial.println("Sensorwert ");
    Serial.print(Sensorwert);
    Serial.println();
  }
}
was meint ihr dazu??

lg

Pages: 1 ... 6 7 [8] 9 10