Show Posts
Pages: 1 ... 3 4 [5] 6 7 ... 44
61  Using Arduino / Programming Questions / Re: syntax for fscale code on: September 19, 2013, 07:17:08 pm
-1 to -64 is the reverse speed...
62  Using Arduino / Programming Questions / syntax for fscale code on: September 19, 2013, 05:51:57 pm
In reference to this code that changes the curve or scale of numbers:
http://playground.arduino.cc/main/fscale

I have this code that give my the desired curve on a reading that is from 1 to 64, but I can't figure out how to get the same result for the values -1 to -64
Code:
  if (motor_speed > 0)  motor_speed = fscale( 1, 64, 1, 64, motor_speed, -1.5);

I thought this would do it, but all it gives me is zeros:
Code:
  if (motor_speed < 0)  motor_speed = fscale( -1, -64, -1, -64, motor_speed, -1.5);
63  Using Arduino / Motors, Mechanics, and Power / Changing to an OLED on: July 08, 2013, 09:53:28 pm
Well, DC42, after getting my first version board back from the fab house, I discovered a few design mistakes, so I'm going to redo it.  I couldn't get the LCD to work, but I'm pretty sure it was something more to do with the LCD, rather than the schematic.  The LCD was this tiny one like the one pictured with a FCP connector, and I'd never used one like it before.  I've recently learned about these little OLED displays like adafruit sells, and want to switch to them on my next attempt at a board. (see link).  The OLED display uses very little current, so I'm guessing I can control it's power directly from a digital pin?
Quote
The power requirements depend a little on how much of the display is lit but on average the display uses about 20mA from the 3.3V supply
  Seems I read somewhere else that with all the pixels lit one used 50ma.  I'll just be using it for text, not graphics, so I won't have anywhere near all the pixels used.
It may be a little while before I resume this project, I'll be gone a few weeks, but here a picture of the schematic I'm guessing will work for powering up/down the OLED from the Atmega328's D4 pin.  Would the I2C pull-ups get connected to D4 as well?
http://learn.adafruit.com/monochrome-oled-breakouts/overview

Thanks for taking a look at this.
64  Using Arduino / General Electronics / Re: Washable crystal on: July 08, 2013, 01:50:12 pm
Thanks for all the feedback. I like the denatured ethanol idea and might give it a try. With a good drying from an old hair dryer.
65  Using Arduino / General Electronics / Re: Washable crystal on: July 07, 2013, 11:04:41 pm
I use hot water and soap. I used to use household alcohol, but it seemed to 'dull' the board --take away the nice shine. I use a flux that is 'water soluable'. I could see parts like the atmega328P-AU, 0803 CAps & Resistors, being unaffected by dipping in hot water but it seemed to me the crystal package would seep liquid into it?  Maybe not??
De-ionized water- will that clean the flux off good?  No soap?  Is that the same as distilled water or is it hard to come by?
66  Using Arduino / General Electronics / Washable crystal on: July 07, 2013, 07:50:16 pm
Is there such a thing as a washable crystal?  I like to give my board a good hot soapy bath after soldering all the washable components on, and would like to use more components that are washable. I've always assumed SMD crystals are not washable. I use this one:
http://www.digikey.com/product-detail/en/ECS-160-20-3X-TR/XC1776CT-ND/2676640
The data sheet says nothing about washable. Anyone know much about crystals and/or of a washable type?
67  Using Arduino / General Electronics / Re: adding LED's to Rx/Tx lines of 328 TFQP SMD to show uploading action on: July 06, 2013, 09:47:37 am
But then when I unplug the FTDI cable, the pins will be low, and the LED's will be on all the time won't they?
68  Using Arduino / Programming Questions / Re: Millis() rover over handling on: July 06, 2013, 09:28:07 am
Oh, I see what you're saying. 
If DoorError() is called, it shuts the whole system down ending with an endless while{} statement, waiting for the user to fix the problem.
69  Using Arduino / Programming Questions / Re: Millis() rover over handling on: July 06, 2013, 09:11:50 am
Code:
There is no problem with rollover, however I can see DoorError being called every 10 mS.
why?  I don't see it.
70  Using Arduino / General Electronics / Re: adding LED's to Rx/Tx lines of 328 TFQP SMD to show uploading action on: July 06, 2013, 09:08:13 am
I think the LEDs referred to are connected to the uC Rx & x lines as added indicaters, not pins 22 & 23 of the FTDI chip.
Correct.
I tested this FTDI cable I use from Sparkfun, and both the Rx/Tx lines are high when I have it plugged in my USB port.
So I may need to just skip the indicator LEDs.  They were just to give a visual on loading sketches.
71  Using Arduino / General Electronics / Re: adding LED's to Rx/Tx lines of 328 TFQP SMD to show uploading action on: July 05, 2013, 11:30:48 pm
I went with the 5K resistors.  Got my first board back for the fab shop with this setup, but they don't work right.  When I plug my FTDI cable into my board, the LEDs are lit up all the time.  I can see them flashing when I load a sketch.  Are the Rx/Tx lines of the FTDI cable normally high?
Here's the schematic of the LED's I added to the Rx/Tx lines.
72  Using Arduino / Programming Questions / Re: Millis() rover over handling on: July 05, 2013, 03:10:18 pm
As long as the interval being timed (30 sec here) is less than the ~50 day millis() rollover interval, and if the comparison is done with subtraction and unsigned variables as it is here (good job!) then the rollover will never be a problem. The code will operate the same even if rollover occurs during the 30 second interval.

Thanks!
73  Using Arduino / Programming Questions / Millis() rover over handling on: July 05, 2013, 02:07:56 pm
In this code, will millis() roll over be a problem?  This routine is called to run a motor twice a day all year.  The mills() is only used to check for a stuck door.  If I've got the logic of it figured out, I think if the rollover does occur during this routine, it just won't have the error protection.  That's fine, I just don't want it to be forced into an error if the rollover happens during the routine.
Code:
void OpenDoor(){
  digitalWrite(HBRIDGEpower, HIGH);  //power up the H Bridge
  delay(1000);  //give it a chance to stabilize
  digitalWrite(motorOpenPin, HIGH);    //Turn on the motor pin that give the open direction
  unsigned long startMillis = millis(); //create a counter
  while(1){
    if (millis() - startMillis > 30000) DoorError(); //longer than 30 sec means the string is tangled
    if (digitalRead(TopSwitch) == 0) { //Switch is closed
      digitalWrite(motorClosePin, LOW);  //Brake
      digitalWrite(motorOpenPin, LOW);  //Brake
      delay(500); //wait a bit
      digitalWrite(HBRIDGEpower, LOW);  //power down the H Bridge
      break;
    }
    delay(10);
  }
}
74  Using Arduino / Networking, Protocols, and Devices / Re: Understand bits/bytes, and reading the datasheet for the DS3234 on: July 03, 2013, 07:53:38 am
I found a library that looks hopeful!
75  Using Arduino / Networking, Protocols, and Devices / Re: Understand bits/bytes, and reading the datasheet for the DS3234 on: July 02, 2013, 10:45:03 pm
Setting the alarm seems WAY harder than reading the time.
I understand most of this example sketch from Sparkfun's site:
http://dlnmh9ip6v2uc.cloudfront.net/datasheets/BreakoutBoards/DS3234_Example_Code.pde

I will need the alarm to sound when the hours, minutes, and seconds match, so I will need to set Bit 7 (A1M4) to 1 on 8Ah. 
I gather this from Table 2, Page 13:
https://www.sparkfun.com/datasheets/BreakoutBoards/DS3234.pdf


If I have my alarm time that I need to set in this variable:
Code:
int AlarmTime [3]; //second,minute,hour
Can someone show me how to set the alarm registers.
It must be similar to this (setting the time)
Code:
//=====================================
int SetTimeDate(int d, int mo, int y, int h, int mi, int s){
int TimeDate [7]={s,mi,h,0,d,mo,y};
for(int i=0; i<=6;i++){
if(i==3)
i++;
int b= TimeDate[i]/10;
int a= TimeDate[i]-b*10;
if(i==2){
if (b==2)
b=B00000010;
else if (b==1)
b=B00000001;
}
TimeDate[i]= a+(b<<4);
 
digitalWrite(cs, LOW);
SPI.transfer(i+0x80);
SPI.transfer(TimeDate[i]);       
digitalWrite(cs, HIGH);
  }
}
Pages: 1 ... 3 4 [5] 6 7 ... 44