0 Views?

Perhaps a quick question, but I'm starting to wonder why my instructable shows up with 0 views. I do know that I've gotten more than that, what with the comments posted on... Is there some kind of algorithm that decides whether or not something is a view? Thanks if you actually answer :P

Topic by Ducky Boy 11 years ago  |  last reply 7 years ago


What is 1 / 0 ? Answered

Here is tricky one try and answer it... 

Question by PREDATOR_UK 8 years ago  |  last reply 8 years ago


Infinity divided by 0?

Does infinity divided by zero theoretically equal any number other than 0 or infinity? I heard something about ohm's law applied to a circuit with an ideal voltage source (which is only theoretically possible) and having the terminals shorted out and at 0 ohms, resulting in the current going up to infinity? 

Question by .Unknown. 9 years ago  |  last reply 7 years ago


static int counter = 0; if ((++counter & 0x3f) == 0) Answered

I have not been ablle to find a laymans discription of what this is counting. Looks like it is counting 63 times from the 0x3f ASCII charactor. I bleave it is counting for the helper light, but what for? #include #include #include Password password = Password( "7457" ); //password to unlock door, can be changed const byte ROWS = 4; // Four rows const byte COLS = 3; // columns const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution // Define the Keymap char keys[ROWS][COLS] = { {'1','2','3',}, {'4','5','6',}, {'7','8','9',}, {'*','0','#',}, }; byte rowPins[ROWS] = { 5, 4, 3, 2 };// Connect keypad ROW0, ROW1, ROW2 and ROW3 to these Arduino pins. byte colPins[COLS] = { 8, 7, 6,};// Connect keypad COL0, COL1 and COL2 to these Arduino pins. Stepper myStepper(stepsPerRevolution, 9,10,11,12); int enable_pin = 13; int button_pin = A0; int button_pinstate = 0; // variable to store current pir state //int lastpirstate = 0; // variable to store last pir state int lastbutton_pinstate = 0; int pos = 35; int pos2 = -35;  // Create the Keypad Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS ); unsigned long offtime; boolean helper_light_is_on = false; // helper light off void setup(){ myStepper.setSpeed(60); // set the speed at 60 rpm: pinMode( button_pin, INPUT); digitalWrite(button_pin, HIGH); // pull-up Serial.begin(9600); Serial.write(254); Serial.write(0x01); delay(200); pinMode(15, OUTPUT); //Helper light pinMode(16, OUTPUT); //green light pinMode(17, OUTPUT); //red light pinMode(enable_pin, OUTPUT); digitalWrite(enable_pin,HIGH); keypad.addEventListener(keypadEvent); //add an event listener for this keypad } void loop() { button_pinstate = digitalRead(button_pin); if(button_pinstate != lastbutton_pinstate) { Serial.println(" Button Press"); if(button_pinstate == LOW)// { delay(10); digitalWrite(enable_pin,HIGH); myStepper.step(pos); Serial.print(" Open "); delay(2000); myStepper.step(pos2); Serial.print(" Close "); digitalWrite(enable_pin,LOW); delay(10); } static int counter = 0; if ((++counter & 0x3f) == 0) Serial.println(); delay(100); keypad.getKey(); myStepper.step(0); process_helper_light(); } void keypadEvent(KeypadEvent eKey) { switch (keypad.getState()) { case PRESSED: // a key is pressed so light the helper light helper_light_is_on = true; digitalWrite(15,HIGH); offtime = millis() + 5000; // set the offtime for 30 seconds in the future Serial.print(" enter: "); Serial.println(eKey); delay(10); Serial.write(254); switch (eKey) { case '*': checkPassword(); delay(1); break; case '#': password.reset(); delay(1); break; default: password.append(eKey); delay(1); } } } void checkPassword() { if (password.evaluate()) //if password is right unlock door { Serial.println(" Accepted"); Serial.write(254); delay(10); digitalWrite(enable_pin,HIGH); myStepper.step(pos); Serial.print(" open "); digitalWrite(16, HIGH);//turn on green led delay(2000); //wait 5 seconds digitalWrite(16, LOW);// turn offgreen led myStepper.step(pos2); digitalWrite(enable_pin,LOW); Serial.print(" Close "); } else { Serial.println(" Denied"); //if passwords wrong keep door locked Serial.write(254); delay(10); myStepper.step(0); Serial.println(" locked "); digitalWrite(17, HIGH); //turn on red led delay(2000); //wait 5 seconds digitalWrite(17, LOW);//turn off red led } }  void process_helper_light(void) { if (helper_light_is_on) { if (millis() >= offtime) { digitalWrite(15,LOW); //turn off the helper light helper_light_is_on = false; } } }

Question by WWC 6 years ago  |  last reply 6 years ago


0-12V Digital Display?

Here's what I need, and haven't been able to figure out how to do it: I designed a motor speed controller that runs a 12V fan.  Speed control is via PWM through a 50K linear Potentiometer. I need to be able to read the percentage of run voltage ie: 0V=0%, 6V=50%, 12V=100%.  I want to display this on 3 7-segment LED displays. Anyone with insight would be greatly appreciated. Brian

Question by BrianAriz 3 years ago  |  last reply 3 years ago


PDF's are 0 (zero) bytes

I am a 'new' Pro Subscriber. I tried downloading .PDF from this posting using Firefox (and Chrome);https://www.instructables.com/id/How-to-program-arcs-and-linear-movement-in-G-Code-/The files are zero bytes. What's up with that. What's the solution?

Question by squattingdog 7 days ago


How to build a 0-36v, 0-10a, Regulated, AC/DC Power Supply? Answered

I'm looking for how to make a variable regulated power supply for DC electronics. I have wall warts and single range transformers for lots of different items ranging from battery chargers to toys to LED lights and am looking to combine them all down into one unit. I need to be able to adjust the voltage from ad little as 1.2v @ 200ma all the way up to 36v @ 10amps. I would normally take the easy way out and buy a power supply online that would handle it, but I am strapped for cash and this is more a luxury then a necessity. If possible I would like to be able to use LCD/LED panel meters that are powered by the input along with fine and coarse controls, along with dual outputs. Something along the lines of the Mastech HY5005E-2 that's pictured below. Maybe convert a cheap PC power supply with a digital multimeter? I can solder and work a basic circuit but I haven't done anything this complicated as yet.  I would appreciate any help offered. Thanks!

Question by Dochide 8 years ago  |  last reply 8 years ago


Arduino Coding Question: How do I blink one LED 8 times and then another LED 8 times then repeat?

I'm using two 4017 decade counters to count to 16 and I figure two Arduino outputs would be a good way to go. I want one 4017 to receive 9 pulses then and then wait while the other 4017 receives 9 pulses. (one pulse is a holding position) For the moment I'm just trying to blink one LED 9 times and then another 9 times to represent two separate clock outputs. Here is a diagram: pin 13    1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, pin 12    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, Start      ------------------------------------------------------------------------------------------------------------ then loop. This is for multiplexing a 16x16 led screen so I don't think I should use the  delay(1000);  command. Each counter needs 9 pulses with the last pulse to the first counter happening simultaneously with the first pulse to the second counter. And similarly the first counter getting its first pulse at the same time as the second counter gets its 9th pulse. Get it?

Question by snotty 9 years ago  |  last reply 7 years ago


Total Views Count - 01/06/2010

Here is the run for the Total Views Group for June 1st 2010. Well done to Canida for having this run's biggest increase in views and to reukpower for having this run's biggest increase as a percentage of their previous count. Instructabler 15/05/2010 01/06/2010    Gain canida 3,196,243 3,255,943 59,700 Kiteman 1,455,778 1,477,354 21,576 Tool Using Animal 1,339,055 1,366,778 27,723 gmjhowe 743,801 753,871 10,070 killerjackalope 721,763 734,416 12,653 PKM 648,766 656,805 8,039 lemonie 591,001 601,737 10,736 ChrysN 0 379,842 0 laxap 275,235 283,047 7,812 Spl1nt3rC3ll 0 242,954 0 plane phanatic 227,946 230,853 2,907 depotdevoid 0 222,694 0 KentsOkay 207,042 209,715 2,673 Lithium Rain 195,250 198,986 3,736 Doctor What 175,023 177,233 2,210 Jayefuu 148,468 153,747 5,279 AngryRedhead 124,911 131,186 6,275 yokozuna 119,854 121,104 1,250 DJ Radio 113,960 116,022 2,062 Lynne Bruning 101,396 103,489 2,093 reukpower 61,096 74,363 13,267 Ninzerbean 70,748 73,330 2,582 thermoelectric 70,675 72,733 2,058 Hiyadudez 66,425 69,878 3,453 Goodhart 67,133 68,296 1,163 BrittLiv 0 50,922 0 kelseymh 36,354 36,950 596 Killer%7ESafeCracker 0 35,014 0 Berkin 0 32,683 0 RavingMadStudios 0 29,226 0 MichelMoermans 0 19,027 0 Shadowman39 16,442 17,524 1,082 knuckel 0 15,725 0 Derin 0 14,927 0 zascecs 13,110 13,564 454 NachoMahma 9,329 9,405 76 MotaBoi 0 9,180 0 nickodemus 0 8,378 0 masterochicken 7,764 7,941 177 kcls 0 5,144 0 acidbass 0 4,721 0 Kryptonite 3,319 3,888 569 megametal8 0 1,395 0 tbcross 0 0 0 yo man 0 0 0 NachoTest01 0 0 0 hempnecklacestore 0 0 0 Steveastrouk                                           10,535

Topic by Jayefuu 8 years ago  |  last reply 8 years ago


which is suitable for producing KCLO3 by electrolysis, fertilizer grade KCL(0-0-60) or food grade KCL?

Fertilizer grade is 0% N, 0% P, 60%K and the rest is KCL while food grade KCL is about 49% KCL and the rest is NaCl

Question by davincicoder 6 years ago  |  last reply 6 years ago


DIY, AC to DC Converter, Variable 0-60vDC, variable 0-10A : is this possible and done with shoestring budget?

Hey, I've been experimenting with Electrolysis and have reached the end of what I can do with a couple of car batteries and a car battery charger. I would like to build a AC to DC converter (as I can't find anything built with the options I want). I believe the sweet spot I am headed for is 52 Volts and 1.5 -3 Amps. I would like to have variable voltage output from 0-60 Volts and variable Amperage output of 0-10 Amps. Is this something than can be put together on a hobbyist's budget? Thanks In advance!

Question by jdevereaux1 7 years ago  |  last reply 7 years ago


WT*#@° :0-(3

Why do only pro member now can dowload the PDF's???? the last time i remembered the free acounts could download them :0-(3 BunnyMacSteam verry sad   :0-(3  

Topic by BunnyMacSteam 7 years ago  |  last reply 7 years ago


Need help with DMX512 to Analog 0-10VDC Decoder

I am looking to *update* some old strobe lights that my theater uses to be able to control them through our DMX control board.  They have 2 analog 0-10V inputs to control the flash rate and the intensity.  I am looking for the simplest solution as we do not have a lot of money to throw at this project.  I have some experience in electronics as well as working with arduino, but not enough to tackle this job by myself.   Any thoughts on this would be appreciated!  Attaching the control spec sheet. Tom

Topic by AJackOfAllTrades 4 years ago  |  last reply 4 years ago


Arduino 5x9 led display and 0-10V voltmeter. Answered

Arduino Duemilanove ATmega328 I want to make a 5x9 led display that monitors a 0-9.99VDC source for a huge motor. I would like to display up to a hundredth of a volt. I would like to do this all using 1 board. I plan on having it display the 3 digits using the 5x9 led display. Can I do this with the limited pins I have without using a shift register? (I think thats what it is called) Do I have all that I need? I have some knowledge of electronics but am in the learning stage but this project will help me a lot in my everyday life. This will be used to monitor a DC water turbine for my pool. I have: -tons of LEDS -Arduino -tons of resistors

Question by newrev426 8 years ago  |  last reply 8 years ago


Address LEDs on a LOL shield help... please?

A couple of the tutorials use the following arrays... http://code.google.com/p/lolshield/downloads/list I spent a couple hours trying to help out a friend and could not dumb the code down to address individual LEDs using the understood matrix below... uint16_t BitMap[][9] PROGMEM = { {1, 0, 0, 0, 0, 0, 0, 0, 0}, {3, 1, 0, 0, 0, 0, 0, 0, 0}, {7, 3, 1, 0, 0, 0, 0, 0, 0}, {15, 7, 3, 1, 0, 0, 0, 0, 0}, {31, 15, 7, 3, 1, 0, 0, 0, 0}, {63, 31, 15, 7, 3, 1, 0, 0, 0}, {127, 63, 31, 15, 7, 3, 1, 0, 0}, {255, 127, 63, 31, 15, 7, 3, 1, 0}, later in the code they use the following to 'fetch' the lines... for(line = 0; line < 9; line++)       {         data = pgm_read_word_near (&BitMap;[frame][line]);   // fetch data from program memory When I try to hi-jack the above line and use my 'own' numbers: data = pgm_read_word_near (&BitMap;[frame[1][3]);... it does not function.. I'm just trying to call out individual LEDs in response to external sensors and turn them ON and OFF with delays and such... any help breaking down this code? I understand the matrix but can't seem to call it out... thanks! HERE is the sample code: #include   //This is in the Arduino library int blinkdelay = 75; //This basically controls brightness. Lower is dimmer int runspeed = 20;   //smaller = faster int pin13 =13; int pin12 =12; int pin11 =11; int pin10 =10; int pin09 =9; int pin08 =8; int pin07 =7; int pin06 =6; int pin05 =5; int pin04 =4; int pin03 =3; int pin02 =2; const int pins[] = {   pin13,pin12,pin11,pin10,pin09,pin08,pin07,pin06,pin05,pin04,pin03,pin02}; const int ledMap[126][2] ={ {pin13, pin05},{pin13, pin06},{pin13, pin07},{pin13, pin08},{pin13, pin09},{pin13, pin10},{pin13, pin11},{pin13, pin12},{pin13, pin04},{pin04, pin13},{pin13, pin03},{pin03, pin13},{pin13, pin02},{pin02, pin13}, {pin12, pin05},{pin12, pin06},{pin12, pin07},{pin12, pin08},{pin12, pin09},{pin12, pin10},{pin12, pin11},{pin12, pin13},{pin12, pin04},{pin04, pin12},{pin12, pin03},{pin03, pin12},{pin12, pin02},{pin02, pin12}, {pin11, pin05},{pin11, pin06},{pin11, pin07},{pin11, pin08},{pin11, pin09},{pin11, pin10},{pin11, pin12},{pin11, pin13},{pin11, pin04},{pin04, pin11},{pin11, pin03},{pin03, pin11},{pin11, pin02},{pin02, pin11}, {pin10, pin05},{pin10, pin06},{pin10, pin07},{pin10, pin08},{pin10, pin09},{pin10, pin11},{pin10, pin12},{pin10, pin13},{pin10, pin04},{pin04, pin10},{pin10, pin03},{pin03, pin10},{pin10, pin02},{pin02, pin10}, {pin09, pin05},{pin09, pin06},{pin09, pin07},{pin09, pin08},{pin09, pin10},{pin09, pin11},{pin09, pin12},{pin09, pin13},{pin09, pin04},{pin04, pin09},{pin09, pin03},{pin03, pin09},{pin09, pin02},{pin02, pin09}, {pin08, pin05},{pin08, pin06},{pin08, pin07},{pin08, pin09},{pin08, pin10},{pin08, pin11},{pin08, pin12},{pin08, pin13},{pin08, pin04},{pin04, pin08},{pin08, pin03},{pin03, pin08},{pin08, pin02},{pin02, pin08}, {pin07, pin05},{pin07, pin06},{pin07, pin08},{pin07, pin09},{pin07, pin10},{pin07, pin11},{pin07, pin12},{pin07, pin13},{pin07, pin04},{pin04, pin07},{pin07, pin03},{pin03, pin07},{pin07, pin02},{pin02, pin07}, {pin06, pin05},{pin06, pin07},{pin06, pin08},{pin06, pin09},{pin06, pin10},{pin06, pin11},{pin06, pin12},{pin06, pin13},{pin06, pin04},{pin04, pin06},{pin06, pin03},{pin03, pin06},{pin06, pin02},{pin02, pin06}, {pin05, pin06},{pin05, pin07},{pin05, pin08},{pin05, pin09},{pin05, pin10},{pin05, pin11},{pin05, pin12},{pin05, pin13},{pin05, pin04},{pin04, pin05},{pin05, pin03},{pin03, pin05},{pin05, pin02},{pin02, pin05} }; uint16_t BitMap[][9] PROGMEM = { {1, 0, 0, 0, 0, 0, 0, 0, 0}, {3, 1, 0, 0, 0, 0, 0, 0, 0}, {7, 3, 1, 0, 0, 0, 0, 0, 0}, {15, 7, 3, 1, 0, 0, 0, 0, 0}, {31, 15, 7, 3, 1, 0, 0, 0, 0}, {63, 31, 15, 7, 3, 1, 0, 0, 0}, {127, 63, 31, 15, 7, 3, 1, 0, 0}, {255, 127, 63, 31, 15, 7, 3, 1, 0}, {511, 255, 127, 63, 31, 15, 7, 3, 1}, {1023, 511, 255, 127, 63, 31, 15, 7, 3}, {2047, 1023, 511, 255, 127, 63, 31, 15, 7}, {4095, 2047, 1023, 511, 255, 127, 63, 31, 15}, {8191, 4095, 2047, 1023, 511, 255, 127, 63, 31}, {16383, 8191, 4095, 2047, 1023, 511, 255, 127, 63}, {16383, 16383, 8191, 4095, 2047, 1023, 511, 255, 127}, {16383, 16383, 16383, 8191, 4095, 2047, 1023, 511, 255}, {16383, 16383, 16383, 16383, 8191, 4095, 2047, 1023, 511}, {16383, 16383, 16383, 16383, 16383, 8191, 4095, 2047, 1023}, {16383, 16383, 16383, 16383, 16383, 16383, 8191, 4095, 2047}, {16383, 16383, 16383, 16383, 16383, 16383, 16383, 8191, 4095}, {16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 8191}, {16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383}, {16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383}, {16382, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383}, {16380, 16382, 16383, 16383, 16383, 16383, 16383, 16383, 16383}, {16376, 16380, 16382, 16383, 16383, 16383, 16383, 16383, 16383}, {16368, 16376, 16380, 16382, 16383, 16383, 16383, 16383, 16383}, {16352, 16368, 16376, 16380, 16382, 16383, 16383, 16383, 16383}, {16320, 16352, 16368, 16376, 16380, 16382, 16383, 16383, 16383}, {16256, 16320, 16352, 16368, 16376, 16380, 16382, 16383, 16383}, {16128, 16256, 16320, 16352, 16368, 16376, 16380, 16382, 16383}, {15872, 16128, 16256, 16320, 16352, 16368, 16376, 16380, 16382}, {15360, 15872, 16128, 16256, 16320, 16352, 16368, 16376, 16380}, {14336, 15360, 15872, 16128, 16256, 16320, 16352, 16368, 16376}, {12288, 14336, 15360, 15872, 16128, 16256, 16320, 16352, 16368}, {8192, 12288, 14336, 15360, 15872, 16128, 16256, 16320, 16352}, {0, 8192, 12288, 14336, 15360, 15872, 16128, 16256, 16320}, {0, 0, 8192, 12288, 14336, 15360, 15872, 16128, 16256}, {0, 0, 0, 8192, 12288, 14336, 15360, 15872, 16128}, {0, 0, 0, 0, 8192, 12288, 14336, 15360, 15872}, {0, 0, 0, 0, 0, 8192, 12288, 14336, 15360}, {0, 0, 0, 0, 0, 0, 8192, 12288, 14336}, {0, 0, 0, 0, 0, 0, 0, 8192, 12288}, {0, 0, 0, 0, 0, 0, 0, 0, 8192}, {0, 0, 0, 0, 0, 0, 0, 0, 0}, {18000} }; void setup() {   blinkall(2); // useful for testing } void loop() {   DisplayBitMap(); } void turnon(int led) {   int pospin = ledMap[led][0];   int negpin = ledMap[led][1];   pinMode (pospin, OUTPUT);   pinMode (negpin, OUTPUT);   digitalWrite (pospin, HIGH);   digitalWrite (negpin, LOW); } void alloff() {   DDRD = B00000010;   DDRB = B00000000; } void DisplayBitMap() {   boolean run=true;   byte frame = 0;   byte line = 0;   unsigned long data;   while(run == true) {     for(int i = 0; i < runspeed; i++)     {       for(line = 0; line < 9; line++)       {         data = pgm_read_word_near (&BitMap;[frame][line]);   // fetch data from program memory         if (data==18000){           run=false;         }         else for (byte led=0; led<14; ++led) {           if (data & (1<             turnon((line*14)+led);             delayMicroseconds(blinkdelay);             alloff();           }           else {             delayMicroseconds(blinkdelay);           }         }       }                  } frame++;    } } void blinkall(int numblink) {   alloff();   for(int n = 0;n < numblink;n++)   {     for(int i = 0; i < runspeed; i++)     {       for(int j = 0; j < 126; j++)       {         turnon(j);         delayMicroseconds(blinkdelay);         alloff();       }     }     delay(500);   } }   } }

Question by hydronics 6 years ago  |  last reply 6 years ago



will this code work? Answered

Q1-here is the code for picaxe 08m2 will it work or something is wrong Q2-to repeat a code what value do i have to give for the FOR loop i have assumed it to be 0 to 0 THE CODE--------- main: if pinc.4 = 1 then main2       if pinc.0 = 1 then main3       if pinc.1 = 1 then main4       goto main       main2:for b0 = 0 to 0       play 2,0       next b0       pause 2000       goto main       main3:for b0 = 0 to 0       play 2,1       next b0       pause 2000       goto main            main4:for b0 = 0 to 0       play 2,3       next b0       pause 2000       goto main

Question by e=mc^2 7 years ago  |  last reply 7 years ago


Experimental engine Answered

Would connecting like 2 or more single cylender horizontal engines like briggs and strattons together flywheel to shaft run as like a 2 cylender in line engine? or has anyone done it even? example : if      [0-     represents an engine with the [ being the flywheel, the 0 the crankcase/block and the - a shaft then this is my idea [0-[0-[0-  and so on like a two cylinder would be [0-[0- would this work? what would i have to do to get this to work?

Question by chris24f22 7 years ago  |  last reply 7 years ago


Countdown timer doesn't exit and the loop never repeats?

We want to run the stepper motor by 180 degrees and want to repeat it after long delay (say 2 hours or so) with a countdown timer displayed in LCD attached to Arduino. Every thing happening successfully except the loop doesn't start after the countdown ends. #include #include const int stepsPerRevolution = 200;  // change this to fit the number of steps per revolution // for your motor // initialize the stepper library on pins 8 through 11: Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11); // initialize the library with the numbers of the interface pins LiquidCrystal lcd(7, 6, 5, 4, 3, 2); int hours = 0; // start hours int minutes = 0; //start min int seconds = 10; //start seconds int stepCount = 0;         // number of steps the motor has taken void setup() {   // initialize the serial port:   Serial.begin(9600);   pinMode(13, OUTPUT);   // set up the LCD's number of columns and rows:   lcd.begin(16, 2);   // Print a message to the LCD. } void loop() {   // set the cursor to column 0, line 0   // (note: line 0 is the first row, since counting begins with 0):   lcd.setCursor(0, 0);   lcd.print("DRUM ROTAING");   for (int i = 0; i <= 100; i++) {     // step one step:     myStepper.step(1);     Serial.print("steps:");     Serial.println(stepCount);     stepCount++;     delay(125);   }   lcd.clear();   lcd.setCursor(0, 0);   lcd.begin(16, 2);   lcd.print("Count Down Timer ");   delay(150);   while (hours > 0 || minutes > 0 || seconds >= 0) {     lcd.setCursor(4, 2);     (hours < 10) ? lcd.print("0") : NULL;     lcd.print(hours);     lcd.print(":");     (minutes < 10) ? lcd.print("0") : NULL;     lcd.print(minutes);     lcd.print(":");     (seconds < 10) ? lcd.print("0") : NULL;     lcd.print(seconds);     lcd.display();     stepDown();     delay(1000);   } } void stepDown() {   if (seconds > 0) {     seconds -= 1;   } else {     if (minutes > 0) {       seconds = 59;       minutes -= 1;     } else {       if (hours > 0) {         seconds = 59;         minutes = 59;         hours -= 1;       } else {               }     }   } } We used break, return 0, continue, etc. but somehow didn't work. Kindly tell how to exit so that program repeats itself. Thanks.

Question by meetshivam 2 years ago  |  last reply 2 years ago


My instructable has 0 View for about 1 day ! ?

Hi, I know this is a common error but what is the solution ?? 

Question by ram mere 4 years ago  |  last reply 4 years ago


Most Contests Showing as "0 days left" in Firefox Browser

When using Firefox to browse the list of contests the majority are showing as "0 days left" to enter, even though the contests are still open. I can only re-create the problem when using the Firefox browser (v54.0.1), Chrome and Internet Explorer behave as expected. I have completely reset my browser (including cookies, history, cache etc.) but the problem persists. If I open a contest page the description shows "Only 0 s left to enter the...." , however the "Enter Now" button is available and appears to work as expected.

Topic by ThirdEarthDesign 1 year ago  |  last reply 1 year ago


How to control speed motor dc 0-5000rpm with Arduino?

Hello,  please I need help to control the speed of a dc motor with, for ex, Arduino. I need it to set the rotate speed of a device that we use in I+D at the Uni. The roate speed that we use is between 0 to 5000 rpm.  Any idea and help is more than welcome!!!!

Question by marianoaste 4 years ago  |  last reply 4 years ago


Which type of diode for 12v 10amp to 12v 0 amp?

Hi all, wondering if you can offer any advice, I'm making a circuit that has two sub circuits:- circuit 1 10 amp transformer, connected to lights circuit 2 6 amp transformer, connected to lights Both these sub circuits will be bridged to  a large circuit , however  I believe I need a diode that will stops the 6 amp transformer getting to circuit 1, but the transformer from circuit 1 to power the lights in circuit 2. If this is correct could someone advise that type of diode I would need to drop the amps to 0. I'm not sure how diodes work however I'm using led lighting that will run off 5v so I'm aiming to have as close to a one way valve for power. Also will I have to place a diode on both the positive and negative or will one surface? Thanks for any help you can offer

Question by C2L 3 years ago  |  last reply 3 years ago


sys/time.h missing when compiling in MS VC++

I am trying to use opencv for my arduino robot. Here's the problem: when I try to compile?rebuild in VC++, it says that /* * The program used in the YouTube video http://www.youtube.com/watch?v=Gg6zqjDq1ho * * This program allow to rotate a webcam to track an object. This is * done by using Arduino to control a servo motor. The communication * is done using a serial connection (through USB or native). * * To compile it under Linux (assuming OpenCV was previously installed): * *   g++ -O2 -W -Wall -lhighgui tracking.cc -o tracking * * See the documentation to get the Arduino program. * * Author: Frédéric Jolliton * Date: january 22, 2011 * Documentation: http://doc.tuxee.net/tracking */ #include #include #include #include #include //-------- PID parameters -------- // See http://en.wikipedia.org/wiki/PID_controller // These values must be chosen CAREFULLY. The strategy to find good // values is to set `ci' and `cd' to 0.0, then try to find a value of // `cp' that works the best (without too much oscillation) then, from // that, lower `cp' and increase `cd' until the system is able to // stalibilize more quickly. Increase `ci' if the system take time to // move to the target position. There are more complexes method to // find the "right" values. static double cp = 0.2; static double ci = 0.0; static double cd = 0.02; /* * Get the current time in seconds */ static double gettime() {   struct timeval tv;   gettimeofday(&tv;, 0);   return tv.tv_sec + tv.tv_usec / 1e6; } int main() {   CvCapture*          capture = cvCreateCameraCapture(0);   if (capture == 0) {     std::cerr << "Failed to open the camera.\n";     return 1;   }   /*    * Window to display the input image.    */   cvNamedWindow("RGB", CV_WINDOW_AUTOSIZE);   cvMoveWindow("RGB", 0, 0);   /*    * Window to display the mask (the selected part of the input image)    */   cvNamedWindow("Mask", CV_WINDOW_AUTOSIZE);   cvMoveWindow("Mask", 0, 505);   /*    * The settings window    */   cvNamedWindow("Settings", 0);   cvMoveWindow("Settings", 652, 505);   // The hue range to select.   int                 hue_level_start = 0;   int                 hue_level_stop = 12;   cvCreateTrackbar("Hue level (start)", "Settings", &hue;_level_start, 255, 0);   cvCreateTrackbar("Hue level (stop)", "Settings", &hue;_level_stop, 255, 0);   // The minimum saturation level.   int                 sat_level = 100;   cvCreateTrackbar("Saturation level", "Settings", &sat;_level, 255, 0);   // Target position.   int                 target = 320;   cvCreateTrackbar("Target", "Settings", &target;, 640, 0);   /*    * Window to display the tracking state    */   cvNamedWindow("Track", CV_WINDOW_AUTOSIZE);   cvMoveWindow("Track", 646, 0);   FILE*               serial = fopen("/dev/ttyACM0", "w");   if (serial == 0) {     printf("Failed to open serial port\n");   }   sleep(1);   IplImage*           chan1 = 0;   IplImage*           chan2 = 0;   IplImage*           chan3 = 0;   IplImage*           hsv = 0;   IplImage*           monitor = 0;   IplImage*           result = 0;   double              angle = 1500.0; // the position of the camera   int                 tcolor = 0; // target color - Used to switch to predefined hue levels.   double              last_time = 0.0; // last time we updated PID   int                 last_known_x = 320; // last known position of the target.   double              last_error = 0.0;   double              i = 0.0; // integral term (here because it is accumulating)   int                 last_sent_value = -1;   for (int n = 0;; ++n) {     //-------- Get the input image --------     IplImage*           frame = cvQueryFrame(capture);     if (frame == 0) break;     cvShowImage("RGB", frame);     //-------- Allocate images --------     if (hsv == 0) {       // Allocate images if it is the first iteration.       hsv     = cvCreateImage(cvGetSize(frame), 8, 3); // 8 bits, 3 channels       chan1   = cvCreateImage(cvGetSize(frame), 8, 1); // 8 bits, 1 channels       chan2   = cvCreateImage(cvGetSize(frame), 8, 1);       chan3   = cvCreateImage(cvGetSize(frame), 8, 1);       monitor = cvCreateImage(cvGetSize(frame), 8, 3);       result  = cvCreateImage(cvGetSize(frame), 8, 3);     }     //-------- Process the input image --------     cvCvtColor(frame, hsv, CV_BGR2HSV); // convert to HSV (Hue-Saturation-Value)     cvSplit(hsv, chan1, chan2, 0, 0); // extract Hue & Saturation     // Create a mask matching only the selected range of hue values.     if (hue_level_start <= hue_level_stop) {       cvInRangeS(chan1, cvScalar(hue_level_start), cvScalar(hue_level_stop), chan1);     } else {       cvInRangeS(chan1, cvScalar(hue_level_stop), cvScalar(hue_level_start), chan1);       cvSubRS(chan1, cvScalar(255), chan1);     }     // Create a mask matching only the selected saturation levels.     cvCmpS(chan2, sat_level, chan2, CV_CMP_GT); // Test Saturation     cvAnd(chan1, chan2, chan3); // Merge masks     cvErode(chan3, chan3, 0, 2); // Suppress noise     // Find the position (moment) of the selected regions.     CvMoments           moments;     cvMoments(chan3, &moments;, 1);     int                 r = sqrt(moments.m00);     int                 x = moments.m10/moments.m00;     int                 y = moments.m01/moments.m00;     //-------- Mask window --------     // blue = hue selection, green = saturation selection, red = selected regions     cvConvertScale(frame, monitor, .3, 0); // faded out input     cvSet(monitor, cvScalar(255, 0, 0), chan1); // blue overlay     cvSet(monitor, cvScalar(0, 255, 0), chan2); // green overlay     cvSet(monitor, cvScalar(0, 0, 255), chan3); // red overlay     if (x > 0 && y > 0) {       cvCircle(monitor, cvPoint(x, y), r, cvScalar(0, 0, 0), 4, CV_AA, 0);       cvCircle(monitor, cvPoint(x, y), r, cvScalar(255, 255, 255), 2, CV_AA, 0);     }     cvShowImage("Mask", monitor);     //-------- Tracking state --------     cvCopy(frame, result, 0); // input image     cvLine(result, cvPoint(target - 60, 0), cvPoint(target - 60, 480), cvScalar(0, 0, 0), 2);     cvLine(result, cvPoint(target, 0), cvPoint(target, 480), cvScalar(0, 0, 255), 3);     cvLine(result, cvPoint(target + 60, 0), cvPoint(target + 60, 480), cvScalar(0, 0, 0), 2);     if (x > 0 && y > 0) {       cvCircle(result, cvPoint(x, y), 10, cvScalar(0, 0, 0), 6, CV_AA, 0);       cvCircle(result, cvPoint(x, y), 10, cvScalar(0, 255, 255), 4, CV_AA, 0);     }     cvShowImage("Track", result);     //-------- Handle keyboard events --------     int key = cvWaitKey(33);     if (key == 27) break;     switch (key) {     case 'r':       // Reset the current position. This is used to check how fast       // the system can return to the correct position.       angle = 1500;       break;     case 't':       // Quickly switch to a different tracking color (red or blue)       tcolor = 1 - tcolor;       if (tcolor == 0) {         cvSetTrackbarPos("Hue level (start)", "Settings", 0);         cvSetTrackbarPos("Hue level (stop)", "Settings", 12);       } else {         cvSetTrackbarPos("Hue level (start)", "Settings", 109);         cvSetTrackbarPos("Hue level (stop)", "Settings", 116);       }       break;     default:       // ignore other keys.       break;     }     //-------- PID processing --------     // If the object is out of the window, use last known position to     // find it.     if (x < 0 || x > 640) {       x = 2.5 * (last_known_x - 320) + 320;     } else {       last_known_x = x;     }     double              time = gettime();     double              dt = time - last_time;     if (last_time == 0.0)       dt = 1.0;     last_time = time;     // the error we want to correct     double              error = x - target;     // the proportional term     double              p = error * cp;     // update the integral term     i += error * dt * ci;     // Clamp integral term     if (i > 30.0)       i = 30.0;     else if (i < -30.0)       i = -30.0;     // the derivative term     double              d = (error - last_error) / dt * cd;     last_error = error;     // the PID value     double              pid = p + i + d;     // Clamp PID     if (pid < -100)       pid = -100;     else if (pid > 100)       pid = 100;     // Update the position from the PID value.     angle += pid;     // Clamp angle     if (angle < 0)       angle = 0;     else if (angle > 2000)       angle = 2000;     printf("pos = %d, P = %f, I = %f, D = %f, angle = %f, dt = %f\n", x, p, i, d, angle, dt);     //-------- Send the position to Arduino --------     if (serial != 0) {       int                 current_value = angle;       // Send the new position if it changed since the last time.       if (current_value != last_sent_value) {         fprintf(serial, "%d\n", current_value);         printf("SENT %d\n", current_value);         last_sent_value = current_value;       }     }   }   cvReleaseCapture(&capture;); } Here's the problem, when i try to compile/rebuild, it says that 

Question by GraffikeL 6 years ago  |  last reply 6 years ago


Controlling a motor with a touch screen ?

So i am trying to control a motors speed using PWM (running through a transistor). I know how to make that happen but i am unsure how to use a touch screen to control the motor,  I have one of the test codes that is a touch pad 0-9 with enter and clear. I was wondering if there was a way that i can punch the number in push enter and have the motor run at that speed(starting with just 0-255) The touch screen is 3.2LCD TFT Touch Screen SD Reader http://www.ebay.com/itm/SainSmart-Mega2560-3-2-TFT-LCD-Shield-Touch-Screen-SD-Reader-4-Arduino-2560-/280930557613?pt=LH_DefaultDomain_0&hash;=item4168c41ead The code is // ITDB02_Touch_ButtonTest (C)2010 Henning Karlsen // web: http://www.henningkarlsen.com/electronics // Modified to work with UTFT on Mega w/Arduino 1.0.1 (C)2012 Otmar Ebenhoech, // // This program is a quick demo of how create and use buttons. // // This program requires the ITDB02_Graph library (8bit mode) // or ITDB02_Graph16 (16bit mode). // // It is assumed that the ITDB02 module is connected to a // ITDB02 Shield, a ITDB02 Mega Shield or that you know how // to change the pin numbers in the setup. // #include #include // Declare which fonts we will be using extern uint8_t BigFont[]; // Uncomment the next line for Arduino 2009/Uno //UTFT myGLCD(ITDB32S,19,18,17,16);   // Remember to change the model parameter to suit your display module! //ITDB02_Touch  myTouch(15,10,14,9,8); // Uncomment the next line for Arduino Mega UTFT myGLCD(ITDB32S,38,39,40,41);   // Remember to change the model parameter to suit your display module! ITDB02_Touch  myTouch(6,5,4,3,2); //// //// ////   ////THIUS IS WHAT I ADDED ETK int motor = 9; ////    //// //// //// int x, y; char stCurrent[20]=""; int stCurrentLen=0; char stLast[20]=""; void setup() {//// //// //// //// tHIS IS WHAT I ADDED ETK pinMode (motor, OUTPUT); //// ////   ////    //// // Initial setup   myGLCD.InitLCD(LANDSCAPE);   myGLCD.clrScr();   myTouch.InitTouch(LANDSCAPE);   myTouch.setPrecision(PREC_MEDIUM);   myGLCD.setFont(BigFont);   myGLCD.setBackColor(0, 0, 255);   // Draw the upper row of buttons   for (x=0; x<5; x++)   {     myGLCD.setColor(0, 0, 255);     myGLCD.fillRoundRect (10+(x*60), 10, 60+(x*60), 60);     myGLCD.setColor(255, 255, 255);     myGLCD.drawRoundRect (10+(x*60), 10, 60+(x*60), 60);     myGLCD.printNumI(x+1, 27+(x*60), 27);   } // Draw the center row of buttons   for (x=0; x<5; x++)   {     myGLCD.setColor(0, 0, 255);     myGLCD.fillRoundRect (10+(x*60), 70, 60+(x*60), 120);     myGLCD.setColor(255, 255, 255);     myGLCD.drawRoundRect (10+(x*60), 70, 60+(x*60), 120);     if (x<4)       myGLCD.printNumI(x+6, 27+(x*60), 87);   }   myGLCD.print("0", 267, 87); // Draw the lower row of buttons   myGLCD.setColor(0, 0, 255);   myGLCD.fillRoundRect (10, 130, 150, 180);   myGLCD.setColor(255, 255, 255);   myGLCD.drawRoundRect (10, 130, 150, 180);   myGLCD.print("Clear", 40, 147);   myGLCD.setColor(0, 0, 255);   myGLCD.fillRoundRect (160, 130, 300, 180);   myGLCD.setColor(255, 255, 255);   myGLCD.drawRoundRect (160, 130, 300, 180);   myGLCD.print("Enter", 190, 147);   myGLCD.setBackColor (0, 0, 0); } void updateStr(int val) {   if (stCurrentLen<20)   {     stCurrent[stCurrentLen]=val;     stCurrent[stCurrentLen+1]='\0';     stCurrentLen++;     myGLCD.setColor(0, 255, 0);     myGLCD.print(stCurrent, LEFT, 224);   }   else   {     myGLCD.setColor(255, 0, 0);     myGLCD.print("BUFFER FULL!", CENTER, 192);     delay(500);     myGLCD.print("            ", CENTER, 192);     delay(500);     myGLCD.print("BUFFER FULL!", CENTER, 192);     delay(500);     myGLCD.print("            ", CENTER, 192);     myGLCD.setColor(0, 255, 0);   } } // Draw a red frame while a button is touched void waitForIt(int x1, int y1, int x2, int y2) {   myGLCD.setColor(255, 0, 0);   myGLCD.drawRoundRect (x1, y1, x2, y2);   while (myTouch.dataAvailable())     myTouch.read();   myGLCD.setColor(255, 255, 255);   myGLCD.drawRoundRect (x1, y1, x2, y2); } void loop() {   while (true)   {     if (myTouch.dataAvailable())     {       myTouch.read();       x=myTouch.getX();       y=myTouch.getY();             if ((y>=10) && (y<=60))  // Upper row       {         if ((x>=10) && (x<=60))  // Button: 1         {           waitForIt(10, 10, 60, 60);           updateStr('1');         }         if ((x>=70) && (x<=120))  // Button: 2         {           waitForIt(70, 10, 120, 60);           updateStr('2');         }         if ((x>=130) && (x<=180))  // Button: 3         {           waitForIt(130, 10, 180, 60);           updateStr('3');         }         if ((x>=190) && (x<=240))  // Button: 4         {           waitForIt(190, 10, 240, 60);           updateStr('4');         }         if ((x>=250) && (x<=300))  // Button: 5         {           waitForIt(250, 10, 300, 60);           updateStr('5');         }       }       if ((y>=70) && (y<=120))  // Center row       {         if ((x>=10) && (x<=60))  // Button: 6         {           waitForIt(10, 70, 60, 120);           updateStr('6');         }         if ((x>=70) && (x<=120))  // Button: 7         {           waitForIt(70, 70, 120, 120);           updateStr('7');         }         if ((x>=130) && (x<=180))  // Button: 8         {           waitForIt(130, 70, 180, 120);           updateStr('8');         }         if ((x>=190) && (x<=240))  // Button: 9         {           waitForIt(190, 70, 240, 120);           updateStr('9');         }         if ((x>=250) && (x<=300))  // Button: 0         {           waitForIt(250, 70, 300, 120);           updateStr('0');         }       }       if ((y>=130) && (y<=180))  // Upper row       {         if ((x>=10) && (x<=150))  // Button: Clear         {           waitForIt(10, 130, 150, 180);           stCurrent[0]='\0';           stCurrentLen=0;           myGLCD.setColor(0, 0, 0);           myGLCD.fillRect(0, 224, 319, 239);         }         if ((x>=160) && (x<=300))  // Button: Enter         {           waitForIt(160, 130, 300, 180);           if (stCurrentLen>0)           {          for (x=0; x             {               stLast[x]=stCurrent[x];             }             stCurrent[0]='\0';             stCurrentLen=0;             myGLCD.setColor(0, 0, 0);             myGLCD.fillRect(0, 208, 319, 239);             myGLCD.setColor(0, 255, 0);             myGLCD.print(stLast, LEFT, 208);             ////             ////              ////             ////THIS IS WAHT I ADDED ETK             analogWrite(motor,stLast);             ////             ////              ////             ////           }           else           {             myGLCD.setColor(255, 0, 0);             myGLCD.print("BUFFER EMPTY", CENTER, 192);             delay(500);             myGLCD.print("            ", CENTER, 192);             delay(500);             myGLCD.print("BUFFER EMPTY", CENTER, 192);             delay(500);             myGLCD.print("            ", CENTER, 192);             myGLCD.setColor(0, 255, 0);           }         }       }     }   } } The stuff i added has these //// on top and bottom with a comment "THIS WAS ADDED  ETK" the part that dont work is "analogWrite(motor,stLast);" and stLast is a char so it give me char to int error. And as you can tell i am no good at this so anything that can point me in the right direction would be greatly appreciated ETK

Question by etkoehn 4 years ago


Need help with Arduino. Xbees won't connect when I upload my code?

I am working on a RC Gripper lifter that works with 2 Servos and 2 DC motors. For wireless control I am using a Series 1 configured Xbee. Now the problem is that the Xbees don't connect when I upload the code. They do connect if I upload some other small code. Here's the Sender Code int potGripper = 1;   int potLifter = 2;   //int oldGripper = 0;   int newGripper = 0;   //int oldLifter = 0;   int newLifter = 0;   int midPin = 2;   int leftPin = 3;   int newGear =0;   int oldGear=1; void setup() {   Serial.begin(9600); pinMode(midPin, INPUT); pinMode(leftPin, INPUT); pinMode(potGripper, INPUT); pinMode(potLifter, INPUT); } void loop() {   if ( digitalRead(midPin) == LOW)   {      oldGear = 1;   }   else if ( digitalRead(leftPin) == LOW)   {       oldGear = 2;   }     int oldGripper = analogRead(potGripper);   int oldLifter = analogRead(potLifter);   int Grippervalue = map(oldGripper,0,1023,0,9);   int Liftervalue = map(oldLifter,0,1023,0,9);   if(newGripper != Grippervalue)   {     Serial.println('!');     Serial.println(Grippervalue);     Serial.println('#');     newGripper = Grippervalue;   }   else if(newLifter != Liftervalue)   {     Serial.println('@');     Serial.println(Liftervalue);     Serial.println('#');     newLifter = Liftervalue;   }   else if( newGear != oldGear)   {     Serial.println(';');     Serial.println(oldGear);     Serial.println('#');     newGear = oldGear;   }   delay(500); } And here's the receiver code- #include //If serial dsn't work as expected, add  while(Serial.available()>0) Serial.read(); at end of each loop! int gripperPin = 9; int lifterPin = 10; int rpmData = 0; int motorLeft, motorRight, gripperData, lifterData, angle, flag; Servo myGripper; Servo myLifter; void setup() {   Serial.begin(9600);   myGripper.attach(gripperPin);   myLifter.attach(lifterPin);   delay(500); } void loop() {   while( Serial.available() == 0);   int data = Serial.read() - '0'; if (data >=0)   {     if(data == ';') // For setting the motor RPM     {       rpmData= Serial.read() - '0';       if (rpmData == 0)       {        motorLeft= 300;        motorRight= 250;       }       else if (rpmData == 1)       {         motorLeft= 200;         motorRight= 150;       }     }     if (data == '!') // For the Gripper     {       gripperData = Serial.read() - '0';       angle= map(gripperData, 0, 9, 0, 80);       myGripper.write(angle);      }     if (data == '@') // For the Lifter     {       lifterData = Serial.read() - '0';       angle= map(lifterData, 0, 9, 0, 160);       myLifter.write(angle);     }     //if (data == '%') // For the Buttons      if (data == '#') // For marking end of Serial Data      {       flag = 0;      }      }     } My main aim is to send a value between 0-9 from one arduino to another so that I can map it on the other arduino from 0-160 and 0-80 (I am using 2 servos). I have used a symbol to differentiate the values from each other so that the correct value reaches the desired servo/motor. Please help me figure out my mistake..

Question by ReshamP 3 years ago  |  last reply 3 years ago


arduino button problems, again

I have a problem with two buttons and a RGB LED. I want the two buttons to be pressed and then the brightness decreases/increases but it isn't working. When i press it, it decreases it but then it doesn't do it again. Any help would be appreciated. Code included below (problem is in bold) : int button = 8; int button_two = 7; int redPin = 6; int greenPin = 5; int bluePin = 3; int val = 0; int val_two = 0; int numb = 0; int r = 0; int g = 0; int b = 0; int i = 0; void setup() {   pinMode(redPin, OUTPUT);   pinMode(greenPin, OUTPUT);   pinMode(bluePin, OUTPUT);   pinMode(button, INPUT);   pinMode(button_two, INPUT);   Serial.begin(9600); } void loop() {   val = digitalRead(button);   val_two = digitalRead(button_two);     if (val == HIGH && val_two == LOW && numb < 7) {     numb++;     delay(300);     } else if (val_two == HIGH && val == LOW && numb > 1) {     numb--;     delay(300);     } else {     numb=numb;   }     if (numb == 1){       r = 255;       g = 255;       b = 255;   }   if (numb == 2){       r = 255;       g = 0;       b = 0;   }   if (numb == 3){       r = 0;       g = 255;       b = 0;   }   if (numb == 4){       r = 0;       g = 0;       b = 255;   }   if (numb == 5){       r = 255;       g = 255;       b = 0;   }    if (numb == 6){       r = 255;       g = 0;       b = 255;   }    if (numb == 7){       r = 0;       g = 255;       b = 255;   }   if (val == HIGH && val_two == HIGH) {       int r_cal = r / 5;     int g_cal = g / 5;     int b_cal = b / 5;         r = r - r_cal;     g = g - g_cal;     b = b - b_cal;   Serial.println(r);   Serial.println(g);   Serial.println(b);   delay(300);   } else {     val == LOW;     val_two == LOW;   }   analogWrite(redPin, r);   analogWrite(greenPin, g);   analogWrite(bluePin, b); }

Topic by Isaac Emery 1 year ago


can i get the circuit diagram of a variable 0-12vdc motor drive circuit using 741IC?

I've made a dc drive circuit using bridge rectifier and 3 741IC op-amp circiut, but the problem is im getting 0-18v across the pot instead of 0-12v.. Canyone suggest how to rectify this problem ? 

Question by sumantharisthus 4 years ago  |  last reply 4 years ago


why i get the following error 'QTR_NO_EMITTER_PIN' was not declared in this scope?

Here is my code: #include #define NUM_SENSORS   1     // number of sensors used #define TIMEOUT       2500  // waits for 2500 us for sensor outputs to go low #define DETECT_LEVEL  150   // Sensor needs to change this amount for detection #define TRIGGER_COUNT 10    // Wait n successive readings valid detection // Create instance of sensors. We are only using one sensor connected to pin 12 PololuQTRSensorsRC qtrrc((unsigned char[]){12}, NUM_SENSORS,TIMEOUT,QTR_NO_EMITTER_PIN); unsigned int sensorValues[NUM_SENSORS]; unsigned int sensorValuesBase[NUM_SENSORS]; unsigned int detect_count[NUM_SENSORS];    // Number of successive times sensor                                            // has detected a drop in value. If                                            // this is greater than trigger_count                                            // then white line detected // Setup pins for SN754410 Motor chip int lf = 6;      // Left motor Forward int lr = 5;      // Left motor Reverse int rf = 11;     // Right motor Forward int rr = 10;     // Right motor Reverse int led = 3;    // LED and resistor across pins 2 and 3 int led_gnd = 2; unsigned char line_detect=1; unsigned char do_turn=0; void setup()  {   pinMode(led, OUTPUT);   pinMode(led_gnd, OUTPUT);     digitalWrite(led_gnd, LOW);    // LED ground     pinMode(13, OUTPUT);   digitalWrite(13, HIGH);        // turn on Sensor   //Read and store the baseline values   qtrrc.read(sensorValues);    sensorValuesBase[0] = sensorValues[0];    } void loop()  {     if(line_detect==1){       // Line Detect is enabled     qtrrc.read(sensorValues);     if(sensorValues[0] < (sensorValuesBase[0]- DETECT_LEVEL)) {       // Detected drop on value - brighter object detected       detect_count[0]++;   // incerment count       if(detect_count[0] >= TRIGGER_COUNT) {         // White Line detected         detect_count[0]=0;          // Reset count         do_turn=1;                  // Start the turn         digitalWrite(led, HIGH);    // turn on LED              line_detect=0;              // Turn off detection until turn complete               // Come to s stop         analogWrite(lf, 0);                 analogWrite(rf, 0);         analogWrite(lr, 0);                 analogWrite(rr, 0);              delay(200);            }      }     else {       detect_count[0]=0;     }    }   if(do_turn==1){     //Turn right a bit to avoid obstacle     analogWrite(lr, 0);         analogWrite(rf, 0);     analogWrite(lf, 200);     analogWrite(rr, 200);           delay(500);                // Turn for half a second     line_detect=1;             // turn line_detect back on     do_turn=0;                 // turn off     digitalWrite(led, LOW);    // turn off Led   }   else {     // go forward until we detect something     // Forward     analogWrite(lr, 0);             analogWrite(rr, 0);     analogWrite(lf, 250);             analogWrite(rf, 250);       } } i add the library and it appear in sketch import library?

Question by hayhackerall 5 years ago  |  last reply 5 years ago


how to make an RC delay to led (not flashing) ? Answered

How to make an RC delay to led (not flashing) ? i have 3 leds and i want them to light up in sequence once they are powered and they keep lighting without flashing for example second 0 > 1 0 0 second 1 > 1 1 0 second 2 > 1 1 1

Question by aessam1 7 years ago  |  last reply 7 years ago


how to write a program to control switch and LED

This program is based on How to Program Switch and LED Connected with PIC16F877A. http://www.kynix.com/BlogImage/9.4.7.png    The following code demonstrate, how to write a program that scan the switch status and turn on and off LED. The switch is connected at PORTE bit-0 and LED connected on PORTB bit-0. When switch is read as high state, the LED is turn-on and when switch state is low, LED is turn-off. The switch debouncing rate is 5msec. The code is written in “mikroC PRO for PIC v.5.6.1” IDE and simulation is done with Proteus 8.0 SP0.  PIC16F877A-I/L Datasheet Code in mikroC [code] // switch connected on porte #define SW_AT_PORT PORTE // debounce rate 5msec #define DBOUNCE_RATE 5 // direction signal sbit LED_dir at TRISB.B0; sbit SW_dir at TRISE.B0; // bit labels portb sbit LED at PORTB.B0; sbit SW at PORTE.B0; // old state save flag bit oldstate_one_to_zero; bit oldstate_zero_to_one; void main(void) { // set porta and porte as digital ADCON1 = 0x06; // set direction as output LED_dir = 0; // set direction as input SW_dir = 1; // init LED LED = 0; // init old state flag oldstate_one_to_zero = 0; oldstate_zero_to_one = 0; while(1) { // Detect logical one if(Button(&SW;_AT_PORT, 0, DBOUNCE_RATE, 1)) { // Update flag oldstate_one_to_zero = 1; } // Detect one-to-zero transition if (oldstate_one_to_zero && Button(&SW;_AT_PORT, 0, DBOUNCE_RATE, 0)) { // Update flag oldstate_one_to_zero = 0; // LED ON LED = SW; } // Detect logical zero if(Button(&SW;_AT_PORT, 0, DBOUNCE_RATE, 0)) { // Update flag oldstate_zero_to_one = 1; } // Detect zero-to-one transition if (oldstate_zero_to_one && Button(&SW;_AT_PORT, 0, DBOUNCE_RATE, 1)) { // Update flag oldstate_zero_to_one = 0; // LED OFF LED = SW; } }} [/code]

Topic by narne 1 year ago  |  last reply 1 year ago


Please help with my Arduino program (controlling servo)? Answered

I started trying the Arduino programming 1 days ago so I'm not sure what is wrong with my program (also, sorry for the messy look) const int buttonPin = 2;     int buttonState = 0;         #include Servo myservo;  int n = 0; int pos; int lc = 0; void setup() {   myservo.attach(9);   pinMode(buttonPin, INPUT);   myservo.write(pos); } void loop() {   buttonState = digitalRead(buttonPin);   if (buttonPin == HIGH)  {     if (lc == 0) {     for(pos = n; pos <= 180; pos++) {     myservo.write(pos);                   buttonState = digitalRead(buttonPin);     if (buttonPin == LOW){       n = pos;       break; }     if (pos == 180) {       n=pos;       lc = 1;}      delay(15);   } }     else {   for(pos = n; pos>=0; pos--)        {                                    myservo.write(pos);                   buttonState = digitalRead(buttonPin);     if (buttonPin == LOW){       n = pos;       break; }     if (n == 0) {       n = pos;       lc = 0;}      delay(15);    } }   } } Basically, it's to use a button to control the servo, if the button is press, the servo will spin (0 to 180 then 180 back to 0), if the button is released, it will stop the servo, and pressing the button will continues the servo movement (not resetting it). The "lc" int is used to show if the servo was moving from 0 to 180 (lc = 0) or 180 back to 0 (lc = 1). I only studied Pascal before so I have a bit trouble understand it so if there was big mistake in my program, please let me know. Thanks for your help.

Question by Shizen 4 years ago  |  last reply 4 years ago


Atmega168 Interrupt help Answered

I'm trying to write code so I get an interrupt on an atmega168 when timer0 overflows. Right now I've got it set up so it blinks an LED every 8th interrupt(~1 second @16mHz /w div 8 prescaler I think), but it doesn't work, so this is where I came. Here's the code:#include #include volatile int flag=0;ISR(TIMER0_OVF_vect){ flag+=1; if(flag>=8){ flag=0; PORTB = (1<<0); }} int main(void){TCCR0A=0b00000000; TCCR0B=0b00000010; TIMSK0 |= (1< TCNT0=0; sei(); DDRC=0b00111100; DDRB |= (1<<0); PORTB |= (1<<0); while(1){ } //End while loop return 0;} //End Main

Question by geeklord 9 years ago  |  last reply 9 years ago


favourite button

Hi :0) I've gone "pro" but can't see a "favourites" option on the Instructables. Please help. Thanks :0)

Topic by porcupinemamma 9 years ago  |  last reply 9 years ago


hii can you help me i dunno how or where i will input the codes to make 0-59 to this code 0 -99?

Int digit1 = 9; int digit2 = 10; int digit3 = 11; int digit4 = 12; int A = 2; int B = 3; int C = 4; int D = 5; int E = 6; int F = 7; int G = 8; void setup() {                  pinMode(A, OUTPUT);   pinMode(B, OUTPUT);   pinMode(C, OUTPUT);   pinMode(D, OUTPUT);   pinMode(E, OUTPUT);   pinMode(F, OUTPUT);   pinMode(G, OUTPUT);   pinMode(digit1, OUTPUT);   pinMode(digit2, OUTPUT);   pinMode(digit3, OUTPUT);   pinMode(digit4, OUTPUT);     pinMode(13, OUTPUT); } void loop() {   displayNumber(millis()/1000); } void displayNumber(int toDisplay) { #define DISPLAY_BRIGHTNESS  1000   long beginTime = millis();   for(int digit = 4 ; digit > 0 ; digit--) {      switch(digit) {     case 1:       digitalWrite(digit1, HIGH);       break;     case 2:       digitalWrite(digit2, HIGH);       break;     case 3:       digitalWrite(digit3, HIGH);       break;     case 4:       digitalWrite(digit4, HIGH);       break;     }     lightNumber(toDisplay % 10);     toDisplay /= 10;     delayMicroseconds(DISPLAY_BRIGHTNESS);           lightNumber(10);        digitalWrite(digit1, LOW);     digitalWrite(digit2, LOW);     digitalWrite(digit3, LOW);     digitalWrite(digit4, LOW);   }   while( (millis() - beginTime) < 10) ; } void lightNumber(int numberToDisplay) { #define SEGMENT_ON  LOW #define SEGMENT_OFF HIGH   switch (numberToDisplay){   case 0:     digitalWrite(A, SEGMENT_ON);     digitalWrite(B, SEGMENT_ON);     digitalWrite(C, SEGMENT_ON);     digitalWrite(D, SEGMENT_ON);     digitalWrite(E, SEGMENT_ON);     digitalWrite(F, SEGMENT_ON);     digitalWrite(G, SEGMENT_OFF);     break;   case 1:     digitalWrite(A, SEGMENT_OFF);     digitalWrite(B, SEGMENT_ON);     digitalWrite(C, SEGMENT_ON);     digitalWrite(D, SEGMENT_OFF);     digitalWrite(E, SEGMENT_OFF);     digitalWrite(F, SEGMENT_OFF);     digitalWrite(G, SEGMENT_OFF);     break;   case 2:     digitalWrite(A, SEGMENT_ON);     digitalWrite(B, SEGMENT_ON);     digitalWrite(C, SEGMENT_OFF);     digitalWrite(D, SEGMENT_ON);     digitalWrite(E, SEGMENT_ON);     digitalWrite(F, SEGMENT_OFF);     digitalWrite(G, SEGMENT_ON);     break;   case 3:     digitalWrite(A, SEGMENT_ON);     digitalWrite(B, SEGMENT_ON);     digitalWrite(C, SEGMENT_ON);     digitalWrite(D, SEGMENT_ON);     digitalWrite(E, SEGMENT_OFF);     digitalWrite(F, SEGMENT_OFF);     digitalWrite(G, SEGMENT_ON);     break;   case 4:     digitalWrite(A, SEGMENT_OFF);     digitalWrite(B, SEGMENT_ON);     digitalWrite(C, SEGMENT_ON);     digitalWrite(D, SEGMENT_OFF);     digitalWrite(E, SEGMENT_OFF);     digitalWrite(F, SEGMENT_ON);     digitalWrite(G, SEGMENT_ON);     break;   case 5:     digitalWrite(A, SEGMENT_ON);     digitalWrite(B, SEGMENT_OFF);     digitalWrite(C, SEGMENT_ON);     digitalWrite(D, SEGMENT_ON);     digitalWrite(E, SEGMENT_OFF);     digitalWrite(F, SEGMENT_ON);     digitalWrite(G, SEGMENT_ON);     break;   case 6:     digitalWrite(A, SEGMENT_ON);     digitalWrite(B, SEGMENT_OFF);     digitalWrite(C, SEGMENT_ON);     digitalWrite(D, SEGMENT_ON);     digitalWrite(E, SEGMENT_ON);     digitalWrite(F, SEGMENT_ON);     digitalWrite(G, SEGMENT_ON);     break;   case 7:     digitalWrite(A, SEGMENT_ON);     digitalWrite(B, SEGMENT_ON);     digitalWrite(C, SEGMENT_ON);     digitalWrite(D, SEGMENT_OFF);     digitalWrite(E, SEGMENT_OFF);     digitalWrite(F, SEGMENT_OFF);     digitalWrite(G, SEGMENT_OFF);     break;   case 8:     digitalWrite(A, SEGMENT_ON);     digitalWrite(B, SEGMENT_ON);     digitalWrite(C, SEGMENT_ON);     digitalWrite(D, SEGMENT_ON);     digitalWrite(E, SEGMENT_ON);     digitalWrite(F, SEGMENT_ON);     digitalWrite(G, SEGMENT_ON);     break;   case 9:     digitalWrite(A, SEGMENT_ON);     digitalWrite(B, SEGMENT_ON);     digitalWrite(C, SEGMENT_ON);     digitalWrite(D, SEGMENT_ON);     digitalWrite(E, SEGMENT_OFF);     digitalWrite(F, SEGMENT_ON);     digitalWrite(G, SEGMENT_ON);     break;   case 10:     digitalWrite(A, SEGMENT_OFF);     digitalWrite(B, SEGMENT_OFF);     digitalWrite(C, SEGMENT_OFF);     digitalWrite(D, SEGMENT_OFF);     digitalWrite(E, SEGMENT_OFF);     digitalWrite(F, SEGMENT_OFF);     digitalWrite(G, SEGMENT_OFF);     break;   } }

Question by MiguelV60 2 years ago  |  last reply 2 years ago


How do I use an Arduino to write say 2.1 volts? Hobo dataloggers accept 0-2.5vdc inputs. Arduino outputs PWM.. thanks!? Answered

I'm working with a university and they love their Hobo's and I don't blame them... they're pretty straight forward to use...  I'd like to write to the Hobo... here's the hobo analog inputs: 0 to 2.5 Vdc; 0 to 5 Vdc; 0 to 10 Vdc; 4-20 mA Hobo stats: http://www.onsetcomp.com/products/data-loggers/u12-006 Analog channels: 0 to 2.5 Vdc; 0 to 5 Vdc; 0 to 10 Vdc; 4-20 mA Accuracy (logger only): ± 2 mV ± 2.5% of absolute reading; ± 2 mV ± 1% of reading for logger-powered sensors Resolution: 0.6 mV Sample Rate: 1 second to 18 hours, user selectable Time accuracy: ± 1 minute per month at 25°C (77°F), see Plot A Operating range: -20 to 70°C (-4° to 158°F) Operating temperature: Logging: -20° to 70°C (-4° to 158°F) Launch/readout: 0° to 50°C (32° to 122°F), per USB specification Humidity range: 0 to 95% RH, non-condensing

Question by hydronics 6 years ago  |  last reply 6 years ago


Why do DC-DC buck-converters not start at 0 volts? Answered

I have been looking into DC-DC converters to build a variable power supply but I've haven't been able to find one which starts at 0 volts. Most of them seem to start at 5-10 volts with the lowest I've seen starting at 0.8 volts. Is there any reason for this? Thanks,

Question by Smret45 2 years ago  |  last reply 2 years ago


123D make: "Number of sheet generated is 0" How to fix this problem?

I got this problem when  I want to print stacked slices. What Do yI do? I CANT CLICK IN SETTINGS "GEAR" BUTTON!

Topic by DIAGONALLIS 2 years ago  |  last reply 2 years ago


How do I create/buy a 0-9v LED Voltmeter?

I am doing a school science fair project and I need to create/buy a LED Voltmeter. It will be hooked up to a DC motor that is connected to my bike. This DC motor is producing about 0-9v. This LED Voltmeter will be used to display how much power is going to be made.

Question by 7Chris Crash 10 years ago  |  last reply 6 years ago


My 'ible isn't showing up on the "recent" list, 0 views! Answered

 Ok, I do have one view...but only because I gave a direct link to my friend. I've waited several hours, but it still hasn't shown up on the recent list...this has never happened to me before! Are instructables processed somehow? Does it sometimes take a long time? The instructable in question is here

Question by nepheron 9 years ago  |  last reply 9 years ago


Instructable has been published for over a day and has 0 views

My pokeball earring instructable has been published for about a day now, but there seems to be 0 views. I know someone must have viewed it, because I shared it with friends, and it was accepted into the Game.Life 2 challenge. A few minutes after I published the instructable, I tried to view said instructable but it said "Instructables is down temporarily" or something to that effect. I waited about five minutes, and came back to see that it was back up again. Everything was working again. This might be an irrelevant detail, howevever. Also the layout is a bit messed up. It might be a problem on my end since I'm using an outdated browser on my school's computer. Check attached image. I'm not sure if this has been addressed already or not, but I wanted to get this out there with the hopes that someone else might have the same problem. Best Regards, ~ Tomcat94

Topic by Tomcat94 7 years ago  |  last reply 7 years ago


0. What is Current ? 1. What is Voltage? 2.What is Frequency?

My Dout is : 0. What is Current ? 1. What is Voltage? 2.What is Frequency? I know Definition. But i need practical example for this thing OK. So what is my dout is 1. When voltage increased current is also increased !      But in some case When voltage increased current decreased OR voltage decreased current increased. How it is possible Current is depend on voltage so When Voltage is zero then current is also zero only know For Example: When 100 Watt bulb receive high voltage then high electron will flow through tungsten of bulb then bulb will give high brightness ok Then same 100 Watt bulb receive low voltage then low amount of electron only flow through the bulb then bulb give low brightness This is the Rule or Nature So Current is depend on voltage only. Then how voltage decreased when current increased. This is my basic dout not only this and many dout about frequency also And Thank U for Replying ME. Thank U

Question by Xzyamaha 7 years ago  |  last reply 1 year ago


Arduino: How do I convert a decimal to ASCII? Answered

I'm following this Instructable which is about communicating between 2 Arduinos with RF modules. The received value is stored in buff[0]  and if this value is "1", a light switches on. However, I was going to experiment with sending values other that 1 or 0 from the other Arduino and first added Serial.println(but[0]) but in the serial monitor, it read 49, which if you treat as a decimal value and convert ASCII, you get "1". Equally, when "0" was sent from the sending Arduino, the monitor read 48, which is decimal of the ASCII value "1". I'm a bit confused as the if-statement below works fine. Basically, I want "1" and "0" to be printed to the serial monitor not 48 and 49. How do I do this? Thanks, theRedBryophyte Serial.println(buf[0]); if(buf[0]=='1'){   //some code here... }

Question by theredbryophyte 3 years ago  |  last reply 2 years ago


Help With arduino Tic tac toe

//This program is a 2 human player tic tsc toe//Created on August 26, 2008 int val; int O; int val2; int playerTurn = 1; int spotOne = 01; // These are the varibles for each possible spot on the grid int spotTwo = 02; int spotThree = 03; int spotFour = 04; int spotFive = 05; int spotSix = 06; int spotSeven = 07; int spotEight = 8; int spotNine = 9; int Player1 = 00; // these will be used to have the players choose their spot on the grid int Player2 = 11; void setup () { Serial.begin(9600); (playerTurn == 1); Serial.println ("Welcome to the two player tic tac toe game."); Serial.println ("Players will take turns putting their choices into the terminal by number."); Serial.println ("Each free space on the grid will have a number on it from 1 to 9."); Serial.println ("Player one will be an 0 and player two will be an 11"); Serial.println ("The first person you get 3 of theor symbols in a row wins"); delay (5000); }void loop (){Serial.println(val);Serial.print (spotOne);Serial.print (" !");Serial.print (spotTwo);Serial.print (" !");Serial.println (spotThree); //First LineSerial.print (spotFour);Serial.print (" !");Serial.print (spotFive);Serial.print (" !");Serial.println (spotSix); //line 2Serial.print (spotSeven);Serial.print (" !");Serial.print (spotEight);Serial.print (" !");Serial.println (spotNine);Serial.print ("It is player ");Serial.print (playerTurn);Serial.println ("'s turn, enter your selection");delay (500); if (playerTurn = 1){ if (Serial.available()) { (val = Serial.read()); if (val == 49){ if (spotOne != 11 || 0){ (spotOne == 11); (playerTurn = 2); } if (val == 50){ if (spotTwo != 11 || 0){ (spotTwo == Player1); (playerTurn = 2); } if (val == 51){ if (spotThree != 11 || 0){ (spotThree == Player1); (playerTurn = 2); } if (val == 52){ if (spotFour != 11 || 0){ (spotFour == Player1); (playerTurn = 2); } if (val == 53){ if (spotFive != 11 || 0){ (spotFive == 11 ); (playerTurn = 2); } if (val == 54){ if (spotSix != 11 || 0){ (spotSix = Player1); (playerTurn = 2); } if (val == 55){ if (spotSeven != 11 || 0){ (spotSeven = Player1); (playerTurn = 2); } if (val == 56){ if (spotEight != 11 || 0){ (spotEight = Player1); (playerTurn = 2); } if (val == 57){ if (spotNine != 11 || 0){ (spotNine = Player1); (playerTurn = 2); }}}}}}}}}} } } if (playerTurn = 2){ if (Serial.available()) { (val = Serial.read()); if (val == 49){ (spotOne == 0); (playerTurn = 1); } if (val == 50){ if (spotTwo != 11 || 0){ (spotTwo = Player2); (playerTurn = 1); } if (val == 51){ if (spotThree != 11 || 0){ (spotThree = Player2); (playerTurn = 1); } if (val == 52){ if (spotFour != 11 || 0){ (spotFour = Player2); (playerTurn = 1); } if (val == 53){ if (spotFive != 11 || 0){ (spotFive = Player2); (playerTurn = 1); } if (val == 54){ if (spotSix != 11 || 0){ (spotSix = Player2); (playerTurn = 1); } if (val == 55){ if (spotSeven != 11 || 0){ (spotSeven = Player2); (playerTurn = 1); } if (val == 56){ if (spotEight != 11 || 0){ (spotEight = Player2); (playerTurn = 1); } if (val == 57){ if (spotNine != 11 || 0){ (spotNine = Player2); (playerTurn = 1); }}}}}}}}} } }} Can anyone help me with this program. I cant quite get it to work properly. You can make changes anywhere.

Topic by sotsirh194 10 years ago  |  last reply 10 years ago


Same thing different name

Is it me or has the same cheap ass projects being posted over and over and over and over and over and over.

Topic by 0-Xero-0 12 years ago  |  last reply 12 years ago


need help with coding for the interactive table designed by grahmaustin

I just cant get it to compile here is the code /***                   PIN ASSIGNMENTS ON ATMEGA48 PC6 (PCINT14/RESET)            PC5 (ADC5/SCL/PCINT13)            // I2C Clock input PC4 (ADC4/SDA/PCINT12)            // I2C Data input PC3 (ADC3/PCINT11)                    //Sensor 4 IR Receiver PC2 (ADC2/PCINT10)                    //Sensor 3 IR Receiver PC1 (ADC1/PCINT9)                      //Sensor 2 IR Receiver PC0 (ADC0/PCINT8)                      //Sensor 1 IR Receiver PB7 (PCINT7/XTAL2/TOSC2)         //IR 4 Trigger PB6 (PCINT6/XTAL1/TOSC1)         //IR 3 Trigger PB5 (SCK/PCINT5)                           //IR 2 Trigger PB4 (MISO/PCINT4)                        //IR 1 Trigger PB3 (MOSI/OC2A/PCINT3)            //PWM 3 PB2 (SS/OC1B/PCINT2)           PB1 (OC1A/PCINT1)               PB0 (PCINT0/CLKO/ICP1)           PD0 (PCINT16/RXD)                PD1 (PCINT17/TXD)                PD2 (PCINT18/INT0)                PD3 (PCINT19/OC2B/INT1)         //PWM 4 PD4 (PCINT20/XCK/T0)            PD5 (PCINT21/OC0B/T1)             //PWM 2 PD6 (PCINT22/OC0A/AIN0)         //PWM 1 PD7 (PCINT23/AIN1)             ***/ #define IR_1_ON PORTB |= (1<<4) #define IR_2_ON PORTB |= (1<<5) #define IR_3_ON PORTB |= (1<<6) #define IR_4_ON PORTB |= (1<<7) #define IR_1_OFF PORTB &= ~(1<<4) #define IR_2_OFF PORTB &= ~(1<<5) #define IR_3_OFF PORTB &= ~(1<<6) #define IR_4_OFF PORTB &= ~(1<<7) #define PWM1 6                    //PORTD        PWM pin assignments #define PWM2 5                    //PORTD #define PWM3 3                    //PORTB #define PWM4 3                    //PORTD #define F_CPU 8000000UL #include #include #include //#include /****Function Declarations****/ int ADC_read(void); void A2D_Channel_Select(unsigned char channel); void Init_ADC(void); void Init_Timer0(void); void Init_Timer1(void); void Init_Timer2(void); void Delay(void); void Calibrate_Sensors(void); //void Init_I2C_Slave_Rx(void); /****Global Variable Declarations****/ volatile char Sensor_Values_Updated = 0;                   volatile char Timer1_Overflow = 0; volatile unsigned char channel = 0; volatile int Amb_Sensor_1 = 0, Amb_Sensor_2 = 0, Amb_Sensor_3 = 0, Amb_Sensor_4 = 0; volatile int Sensor_1 = 0, Sensor_2 = 0, Sensor_3 = 0, Sensor_4 = 0; volatile int Initial_1 = 0, Initial_2 = 0, Initial_3 = 0, Initial_4 = 0; volatile int New_PWM1 = 0, New_PWM2 = 0, New_PWM3 = 0, New_PWM4 = 0;               volatile int Old_PWM1 = 0, Old_PWM2 = 0, Old_PWM3 = 0, Old_PWM4 = 0; unsigned char buffer = 8; int main(void) {  DDRB = 0xff;     //make sure IR emitters are turned off, and PWM 3     PORTB &= ~((1 << 7)|(1 << 6)|(1 << 5)|(1 << 4)|(1 << 3));                   DDRC = 0x00;                    //make PORT C inputs        DDRD = 0xff;     PORTD = 0x00;                    //set all of PORT D low. ensures            Init_ADC();     sei();        Calibrate_Sensors();     PORTD |= (1 << PWM1);            //blink to indicate end of Calibration     _delay_ms(600);     PORTD &= ~(1 << PWM1);     Init_Timer0();     Init_Timer2();     //Init_I2C_Slave_Rx();     while(1)         {             //do something?             //. . .         } } ISR(TIMER1_OVF_vect)      {         Timer1_Overflow++;            //increment timer overflow variable                switch(Timer1_Overflow)             {                 case 1:                                       A2D_Channel_Select(0);                            //select ADC channel 0                     Amb_Sensor_1 = ADC_read();                 //take ambient IR sensor reading                     IR_1_ON;                                                        //turn on IR 1 LED, PORTB |= (1<<4)                     Delay();                                                           //delay for the IR receiver to settle                     Sensor_1 = ADC_read();                            //take active ADC reading of IR receiver                     IR_1_OFF;                                                       //turn off IR 1 LED                       New_PWM1 = (Sensor_1 - Amb_Sensor_1) - Initial_1;    //condition readings                     if(New_PWM1 <= 0)    { New_PWM1 = 0; }                //prevent negative numbers                       New_PWM1 = ((7*Old_PWM1)>>3) + (New_PWM1>>3);                           if(OCR0A >= 1)    {DDRD |= (1 << PWM1);}                     else { DDRD &= ~(1 << PWM1); }                        //turn off LEDs completely                       New_PWM1 <<= 2;                                                                          if(New_PWM1 > 255)    { New_PWM1 = 255; }                     OCR0A = New_PWM1;                     New_PWM1 >>= 2;                         /*****        //Trigger sequence                     if(New_PWM1 > Initial_1)                         {                             DDRD |= (1 << PWM1);                             if(OCR0A < 255)                                   {                                     OCR0A += (255 - OCR0A)>>2 ;                                     //OCR0A++;                                 }                             if (New_PWM1 < (Initial_1 + 8))                                 {                                     Initial_1 = ((7*Initial_1)>>3) + (New_PWM1>>3);                                 }                         }                     else if(New_PWM1 < Initial_1)                         {                             if(OCR0A > 0)                                   {                                     OCR0A -= (OCR0A >> 4)+1;                                     //OCR0A--;                                 }                             else if(OCR0A <= 0)                                   {                                     DDRD &= ~(1 << PWM1);                                 }                         }                          *****/                       Old_PWM1 = New_PWM1;                                           break;                        case 2:                     A2D_Channel_Select(1);                            //select ADC channel 1                     Amb_Sensor_2 = ADC_read();                     IR_2_ON;                                        //turn on IR 2 LED, PORTB |= (1<<5)                     Delay();                                        //delay for the IR receiver to settle                     Sensor_2 = ADC_read();                            //take ADC reading                     IR_2_OFF;                                        //turn off IR 2 LED                       New_PWM2 = (Sensor_2 - Amb_Sensor_2) - Initial_2;                     if(New_PWM2 < 0)    { New_PWM2 = 0; }                                        New_PWM2 = ((7*Old_PWM2)>>3) + (New_PWM2>>3);                     if(OCR0B >= 1)    {DDRD |= (1 << PWM2);}                     else { DDRD &= ~(1 << PWM2); }                     New_PWM2 <<= 2;                     if(New_PWM2 > 255)    { New_PWM2 = 255; }                     OCR0B = New_PWM2;                     New_PWM2 >>= 2;                 /*                     if(New_PWM2 > Initial_2)                         {                             DDRD |= (1 << PWM2);                             if(OCR0B < 255)                                   {                                     OCR0B += (255 - OCR0B)>>2 ;                                     //OCR0B++;                                 }                             if (New_PWM2 < (Initial_2 + 8))                                 {                                     Initial_2 = ((7*Initial_2)>>3) + (New_PWM2>>3);                                 }                         }                     else if(New_PWM2 < Initial_2)                         {                             if(OCR0B > 0)                                   {                                     OCR0B -= (OCR0B >> 4)+1;                                     //OCR0B--;                                 }                             else if(OCR0B <= 0)                                   {                                     DDRD &= ~(1 << PWM2);                                 }                         }                               */                     Old_PWM2 = New_PWM2;                       break;                                    case 3:                     A2D_Channel_Select(2);                            //select ADC channel 2                     Amb_Sensor_3 = ADC_read();                     IR_3_ON;                                        //turn on IR 3 LED, PORTB |= (1<<6)                     Delay();                                        //delay for the IR receiver to settle                     Sensor_3 = ADC_read();                            //take ADC reading                     IR_3_OFF;                                        //turn off IR 3 LED                       New_PWM3 = (Sensor_3 - Amb_Sensor_3) - Initial_3;                     if(New_PWM3 < 0)    { New_PWM3 = 0; }                                        New_PWM3 = ((7*Old_PWM3)>>3) + (New_PWM3>>3);                     if(OCR2A >= 1)    {DDRB |= (1 << PWM3);}                     else { DDRB &= ~(1 << PWM3); }                     New_PWM3 <<= 2;                     if(New_PWM3 > 255)    { New_PWM3 = 255; }                     OCR2A = New_PWM3;                     New_PWM3 >>= 2;                 /*                     if(New_PWM3 > Initial_3)                         {                             DDRB |= (1 << PWM3);                             if(OCR2A < 255)                                   {                                     OCR2A += (255 - OCR2A)>>2 ;                                     //OCR2A++;                                 }                             if (New_PWM3 < (Initial_3 + 8))                                 {                                     Initial_3 = ((7*Initial_3)>>3) + (New_PWM3>>3);                                 }                         }                     else if(New_PWM3 < Initial_3)                         {                             if(OCR2A > 0)                                   {                                     OCR2A -= (OCR2A >> 4)+1;                                     //OCR2A--;                                 }                             else if(OCR2A <= 0)                                   {                                     DDRB &= ~(1 << PWM3);                                 }                         }                               */                     Old_PWM3 = New_PWM3;                       break;                                    case 4:                     A2D_Channel_Select(3);                            //select ADC channel 3                     Amb_Sensor_4 = ADC_read();                     IR_4_ON;                                        //turn on IR 4 LED, PORTB |= (1<<7)                     Delay();                                        //delay for the IR receiver to settle                     Sensor_4 = ADC_read();                            //take ADC reading                     IR_4_OFF;                                        //turn off IR 4 LED                       New_PWM4 = (Sensor_4 - Amb_Sensor_4) - Initial_4;                     if(New_PWM4 < 0)    { New_PWM4 = 0; }                                        New_PWM4 = ((7*Old_PWM4)>>3) + (New_PWM4>>3);                     if(OCR2B >= 1)    {DDRD |= (1 << PWM4);}                     else { DDRD &= ~(1 << PWM4); }                     New_PWM4 <<= 2;                     if(New_PWM4 > 255)    { New_PWM4 = 255; }                     OCR2B = New_PWM4;                     New_PWM4 >>= 2;                 /*                     if(New_PWM4 > Initial_4)                         {                             DDRD |= (1 << PWM4);                             if(OCR2B < 255)                                   {                                     OCR2B += (255 - OCR2B)>>2 ;                                     //OCR2B++;                                 }                             if (New_PWM4 < (Initial_4 + 8))                                 {                                     Initial_4 = ((7*Initial_4)>>3) + (New_PWM4>>3);                                 }                         }                     else if(New_PWM1 < Initial_4)                         {                             if(OCR2B > 0)                                   {                                     OCR2B -= (OCR2B >> 4)+1;                                     //OCR2B--;                                 }                             else if(OCR2B <= 0)                                   {                                     DDRD &= ~(1 << PWM4);                                 }                         }                           */                     Old_PWM4 = New_PWM4;                                        Timer1_Overflow = 0;                    //reset                                                           Sensor_Values_Updated = 1;                //new values ready                                              break;                   }//end switch     }//end ISR  

Topic by CulturalC 1 year ago  |  last reply 1 year ago


How to use Multiple mcp23017 chips with the adafruit mcp23017.h library?

I have been experimenting with I2C and the mcp23017 IO expander chip for my arduino ATMega2560 as I would rather use the IO on the arduino its self for other things I am just figuring out how to use the adafruit mcp23017.h library and cant figure out how to address multiple mcp23017 chips and how to use there pins individually this is the code from the button library that I editied. Here is the datesheet of mcp23017 I want to be able to address the individual chips and the pins I was not quite sure if in the setup that the pin modes for the IO go up sequentially from 0 past 15 if multiple chips are connected and addressed in code. For example if the first chip is addressed as 0x20 and the IO number count is from 0 - 15 if I added and addressed another chip as 0x21 will that count go from 0 - 15 to 0 - 31. ~ Edit if you could recommend or send a library that would be easier or could help please do. #include #include "Adafruit_MCP23017.h" //pin 1 and 0 are mcp pins not arduino IO pins Adafruit_MCP23017 mcp; void setup() {  mcp.begin();      // use default address 0 mcp.pinMode(0, INPUT); mcp.pinMode(1, OUTPUT); Serial.begin(9600); pinMode(13, OUTPUT);  // use the p13 LED as debugging } void loop() { // The LED will 'echo' the button digitalWrite(13, mcp.digitalRead(0)); //Writes pin 13 to the reading of pin    0 mcp.digitalWrite(1, mcp.digitalRead(0)); //Writes pin 1 to the reading of 0 if(mcp.digitalRead(1) == HIGH){ //if pin 1 == high serialprint led whent   high Serial.println("Led whent HIGH"); } }

Question by DELETED_MakiY2 1 year ago  |  last reply 1 year ago


Trying to make a arduino based photo booth, and need help with my code for the countdown to be triggered by a button?

I am new to Arduino and am trying to make an Arduino based Photo Booth which will have a button that is pressed and triggers a countdown on an 8x8 SPI matrix and at the end of the countdown it triggers a SLR Camera (Nikon D5500) (i still need to work out how to trigger the camera and write the camera trigger code). at the moment i have managed to create code that starts the countdown when a button is pressed however it seems to only want to listen to the button randomly and triggers whenever it seems to feel like it. Here is the code i have so far...Have i written it correctly? #include "LedControl.h" const int buttonPin = 2;     // the number of the pushbutton pin int buttonState = 0;         // variable for reading the pushbutton status LedControl lc=LedControl(12,11,10,1);  // Pins: DIN,CLK,CS, # of Display connected unsigned long delayTime=1000;  // Delay between Frames // Put values in arrays byte invader1a[] = {   B01111110, // #9   B11111111,   B11100111,   B11111111,   B01111111,   B00000111,   B11111111,   B01111110 }; byte invader1b[] = {   B01111110, // #8   B11111111,   B11100111,   B01111110,   B01111110,   B11100111,   B11111111,   B01111110 }; byte invader1c[] = {   B11111111, // #7   B11111111,   B00000111,   B00001110,   B00011100,   B00111000,   B00111000,   B00111000 }; byte invader1d[] = {   B01111110, // #6   B11111111,   B11100000,   B11111110,   B11111111,   B11100111,   B11111111,   B01111110 }; byte invader1e[] = {   B11111111, // #5   B11111111,   B11100000,   B11111110,   B11111111,   B00000111,   B11111111,   B01111110 }; byte invader1f[] = {   B11101110, // #4   B11101110,   B11101110,   B11111111,   B11111111,   B00001110,   B00001110,   B00001110 }; byte invader1g[] = {   B11111110, // #3   B11111111,   B00000111,   B11111110,   B11111110,   B00000111,   B11111111,   B11111110 }; byte invader1h[] = {   B01111110, // #2   B11111111,   B11100111,   B00001110,   B00111000,   B11100000,   B11111111,   B11111111 }; byte invader1i[] = {   B00011100, // #1   B00111100,   B01111100,   B00011100,   B00011100,   B00011100,   B00011100,   B00011100 }; byte invader1j[] = {   B00000000, // #smile   B00000000,   B00100100,   B00000000,   B10000001,   B01000010,   B00111100,   B00000000 }; byte invader1k[] = {   B00000000, // #blank   B00000000,   B00000000,   B00000000,   B00000000,   B00000000,   B00000000,   B00000000 }; void setup() {   lc.shutdown(0,false);  // Wake up displays   lc.shutdown(1,false);   lc.setIntensity(0,5);  // Set intensity levels   lc.setIntensity(1,5);   lc.clearDisplay(0);  // Clear Displays   lc.clearDisplay(1);   pinMode(buttonPin, INPUT); } //  Take values in Arrays and Display them void sinvader1a() {   for (int i = 0; i < 8; i++)    {     lc.setRow(0,i,invader1a[i]);   } } void sinvader1b() {   for (int i = 0; i < 8; i++)   {     lc.setRow(0,i,invader1b[i]);   } } void sinvader1c() {   for (int i = 0; i < 8; i++)   {     lc.setRow(0,i,invader1c[i]);   } } void sinvader1d() {   for (int i = 0; i < 8; i++)   {     lc.setRow(0,i,invader1d[i]);   } } void sinvader1e() {   for (int i = 0; i < 8; i++)   {     lc.setRow(0,i,invader1e[i]);   } } void sinvader1f() {   for (int i = 0; i < 8; i++)   {     lc.setRow(0,i,invader1f[i]);   } } void sinvader1g() {   for (int i = 0; i < 8; i++)   {     lc.setRow(0,i,invader1g[i]);   } } void sinvader1h() {   for (int i = 0; i < 8; i++)   {     lc.setRow(0,i,invader1h[i]);   } } void sinvader1i() {   for (int i = 0; i < 8; i++)   {     lc.setRow(0,i,invader1i[i]);   } } void sinvader1j() {   for (int i = 0; i < 8; i++)   {     lc.setRow(0,i,invader1j[i]);   } } void sinvader1k() {   for (int i = 0; i < 8; i++)   {     lc.setRow(0,i,invader1k[i]);   } } void loop() {// read the state of the pushbutton value:   buttonState = digitalRead(buttonPin);   // check if the pushbutton is pressed.   // if it is, the buttonState is HIGH:   if (buttonState == HIGH) {     sinvader1a();     delay(delayTime);     sinvader1b();     delay(delayTime);     sinvader1c();     delay(delayTime);     sinvader1d();     delay(delayTime);     sinvader1e();     delay(delayTime);     sinvader1f();     delay(delayTime);     sinvader1g();     delay(delayTime);     sinvader1h();     delay(delayTime);     sinvader1i();     delay(delayTime);     sinvader1j();     delay(delayTime);     sinvader1k();   } if (buttonState == LOW) {    buttonState = digitalRead(buttonPin);   }   }

Question by DanielB118 3 years ago  |  last reply 3 years ago


can anybody tell me why my return command in void loop isnt working?

Int keyscan() {     const int keys[12]={     1,2,3,4,5,6,7,8,9,10,11,12                  };       int r=0;   int c=0;   int keypress=99;   int ColState = 0;    //variable to store column state, 0 = low } const int led2pin = 10; const int led3pin = 9; const int led4pin = 8; const int buzzer = 12; const int LidSw =  13; const int ROW0 = 7; const int ROW1 = 6; const int ROW2 = 5; const int ROW3 = 4; const int COL0 = 3; const int COL1 = 2; const int COL2 = 1;   int keypress=99;    int r=0;   int c=0;   int ColState = 0; void setup() {   pinMode(ROW0, OUTPUT);   pinMode(ROW1, OUTPUT);   pinMode(ROW2, OUTPUT);   pinMode(ROW3, OUTPUT);   pinMode(COL0, INPUT); pinMode(COL1, INPUT);   pinMode(COL2, INPUT);   }   void loop()   {while(keypress=99)   {               for(r=0; r<4; r++)                          //loop for 4 rows     {       digitalWrite(ROW0, HIGH);       for(c=0;c<3;c++)                          //loop for 3 columns       {         ColState =  digitalRead(COL0);         if(ColState==1)         {           digitalWrite(ROW0, LOW);  //reset row           tone(buzzer, 450, 500);           ColState = 0;                //reset ColState variable           keypress = ROW0+COL0;    //identify key pressed           delay(500);                  //debounce         return keypress;         }       }       digitalWrite(ROW0, LOW);     }   } }

Topic by endara 6 years ago  |  last reply 6 years ago


Im repurposing my atx power supply to be a bench Psu. I need help with code please?

In this project. I want to use an arduino mega, 2 lcds, and 6 acs712 current sensing modules and 2 Lm2596 dc step up/down module The set up I have in mind is like so; arduino is powered by ATX stand by power (IF possible) there is a push button which turns on the programing to start the monitoring and also grounds the ATX and GReen wire to supply power to all the rails. This set up will calculate Voltage and current printting them on the lcd's. The constant voltages will be printed on on lcd and the variable voltages on the other lcd. Ive written most of the code. I just want it to make sense. I've added a picture, which my project is based on.. the difference are, im not using I2c bus for lcd, im measuring current, and im printing info on two different lcds. thanks for the help. here is the code #include #define PWROK_PIN 4 // change to w.e pin i end up using connected to green? investigate #define PWRBTN 2 // closing push buttom connection makes it high #define PWRTRANS 6 /*-----( Declare objects )-----*/ // Variables will change: int PWRSTATE = HIGH;         // the current state of the output pin int buttonState;             // the current reading from the input pin int lastButtonState = LOW;   // the previous reading from the input pin // the following variables are long's because the time, measured in miliseconds, // will quickly become a bigger number than can be stored in an int. long lastDebounceTime = 0;  // the last time the output pin was toggled long debounceDelay = 50;    // the debounce time; increase if the output flickers // initialize the libr with the number of the intface pins double sensePinVthree = A0; double sensePinVfive = A1; double sensePinVfivesb = A2; double sensePinVtw = A3; double sensePinVrone = A4; double sensePinvrtwo = A5; //The current double sensePinIthree   = A6; double sensePinIfive   = A7; double sensePinIfivesb = A8; double sensePinItw  = A9; double sensePinIVrone = A10; double sensePinIVrtwo = A11; //setting up default or naming variables. double Voltsthree; double Voltsfive; double Voltsfivesb; double Voltstw; double VoltsVrone; double VoltsVrtwo; double Currentthree; double Currentfive; double Currentfivesb; double Currenttw; double CurrentVrone; double CurrentVrtwo; LiquidCrystal lcd(12, 11, 5, 4, 3, 2); LiquidCrystal lcd2(12, 10, 5, 4, 3, 2); //remove this if not working or glitchy void checkPowerOK(){   // when green is grounded   if (digitalRead(PWROK_PIN) == HIGH) {     lcd.setCursor(4, 1);     lcd.print("ON ");     lcd.setCursor(9, 3);     lcd.print("hello");   }   else if (digitalRead(PWROK_PIN) == LOW) {     lcd.setCursor(8,1);     lcd.print("OFF");   } } void togglePower(){ static unsigned long last_interrupt_time = 0; unsigned long interrupt_time = millis(); // If interrupts come faster than 200ms, assume it's a bounce and ignore if (interrupt_time - last_interrupt_time > 500) {    // set the power:   digitalWrite(PWRTRANS, PWRSTATE); //trans is pin 6 } PWRSTATE = !PWRSTATE; last_interrupt_time = interrupt_time;  } void setup() { analogReference (DEFAULT); pinMode(PWRBTN, INPUT); pinMode(PWRTRANS, OUTPUT); attachInterrupt(0, togglePower, RISING); digitalWrite(PWRTRANS, PWRSTATE);     lcd.begin(16, 4);   lcd2.begin(16, 2); // Print a message to the LCD. lcd.setCursor(0,0); //take this out if monitor buggy lcd.print("Bench PSU");// this code be fine lcd.setCursor(0,1); lcd.print("Monitor  V1.0"); lcd.setCursor(0,2); lcd.print("ICE"); lcd.setCursor(4,3); lcd.print("ROBOTICS"); lcd2.begin(16, 2); // replace with the date_time function lcd2.setCursor(0,0); lcd2.print("Hope 4 the best"); lcd2.setCursor(0, 1); lcd2.print("prep 4 the worst"); delay(3000); lcd.clear(); // wipes old message lcd.setCursor(5,0);  lcd.print("Building the Future"); lcd.setCursor(0,1); lcd.print("since   2014"); //Inset the time function somewhere in here lcd.clear(); lcd2.clear(); //lcd.createChar(0, blockChar);     Voltsthree=0; //setting my variables to Zero   Voltsfive=0;   Voltsfivesb=0;   Voltstw=0;   Currentthree=0; //Setting current to Zero on this Lcd   Currentfive=0;   Currentfivesb=0;   Currenttw=0;       VoltsVrone=0; // doing the same but for second lcd   VoltsVrtwo=0;     CurrentVrone=0;// same for current   CurrentVrtwo=0; } void loop () {checkPowerOK(); // check to see if power ok   Voltsthree = ((analogRead(sensePinVthree)) /218.0) *5; // or 7 aalso the 218.0 value will chaange to mine specific   if(Voltsthree <0){     Voltsthree=0;   }   Currentthree =(((analogRead(sensePinIthree)) / 212.0) -2.55) / 0.6666667;// why 0.667   if(Currentthree <0) {     Currentthree=0;   }   Voltsfive = ((analogRead(sensePinVfive)) /218.0) *5;   if(Voltsfive <0){     Voltsfive=0);   }   Currentfive =(((analogRead(sensePinIfive)) / 212.0) -2.55) / 0.6666667;// why 0.667   if(Currentfive <0) {     Currentfive=0;   }   Voltsfivesb =((analogRead(sensePinVfivesb)) /218.0) *5;   if(Voltsfivesb <0){     Voltsfivesb=0;   }   Currentfivesb =(((analogRead(sensePinIfivesb)) / 212.0) -2.55) / 0.6666667;// why 0.667   if(Currentfivesb <0) {     Currentfivesb=0;   }   Voltstw =((analogRead(sensePinVtw)) /218.0) *5;   if(Voltstw <0){     Voltstw= 0;   }   Currenttw =((analogRead(sensePinItw)) / 212.0) -2.55) / 0.6666667;// why 0.667   if(Currenttw <0){     Currenttw=0;   }     VoltsVrone =((analogRead(sensePinVrone)) /218.0) *5;   if(VoltsVrone <0){     VoltsVrone=0;   }   CurrentVrone =(((analogRead(sensePinIVrone)) / 212.0) -2.55) / 0.6666667;// why 0.667   if(CurrentVrone <0) {     CurrentVrone=0;   }     VoltsVrtwo =((analogRead(sensePinVrtwo)) /218.0) *5;   if(VoltsVrtwo <0){     VoltsVrtwo = 0;   }   CurrentVrtwo =(((analogRead(sensePinIVrtwo)) / 212.0) -2.55) / 0.6666667;// why 0.667   if(CurrentVrtwo <0) {     CurrentVrtwo=0;   }   //1st line   lcd.setCursor(0,0);   lcd.print("                "); //clear the line 1st line   lcd.setCursor(0,0);   lcd.print(Voltsthree);   lcd.setCursor(5,0):   lcd.print("V");   lcd.setCursor(7,0);   lcd.print(Currentthree);   lcd.setCursor(14,0);   lcd.print("A");     //2nd line   lcd.setCursor(0,1);                  // clear and print second line   lcd.print("                ");   lcd.setCursor(0,1);   lcd.print(Voltsfive);     lcd.setCursor(5,1);   lcd.print("V");   lcd.setCursor(7,1);   lcd.print(Currentfive);   lcd.setCursor(14,1);   lcd.print("A");     //3rd line   lcd.setCursor(0,2);           // clear line 3   lcd.print("                ");   lcd.setCursor(0,2);   lcd.print(Voltsfivesb);     lcd.setCursor(5,2);   lcd.print("V");   lcd.setCursor(7,2);   lcd.print(Currentfivesb);   lcd.setCursor(14,2);   lcd.print("A");     //4th line   lcd.setCursor(0,3);           // clear line 4   lcd.print("                ");   lcd.setCursor(0,3);   lcd.print(Voltstw);     lcd.setCursor(5,3);   lcd.print("V");   lcd.setCursor(7,3);   lcd.print(Currenttw);   lcd.setCursor(14,3);   lcd.print("A");     //1st line   lcd.setCursor(0,0);   lcd.print("                "); //clear the line 1st line   lcd.setCursor(0,0);   lcd.print(VoltsVrone.);   lcd.setCursor(5,0);   lcd.print("V");   lcd.setCursor(7,0);   lcd.print(CurrentVrone);   lcd.setCursor(14,0);   lcd.print("A");     //2nd line   lcd2.setCursor(0,1);                   // clear and print second line   lcd.print("                ");   lcd.setCursor(0,1);   lcd.print(VoltsVrtwo);     lcd.setCursor(5,1);   lcd.print("V");   lcd.setCursor(7,1);   lcd.print(CurrentVrtwo);   lcd.setCursor(14,1);   lcd.print("A");   }

Question by icey.hood 3 years ago  |  last reply 3 years ago