will somebody help me make this (link within question) but says comment? Answered

I need help making a type of free drawn ascii. It is on darkvolts page page here-->https://www.instructables.com/member/DarkVolt/ its where its about himself.

Asked by EncasedDeath 8 years ago


ASCII Image Conversion game

Step one: go to http://asciiconvert.com/ and select an image and limit your characters to 40Step two: Click convert and copy/paste ASCII text into a replyStep three: attach original imageStep four: ????Step five: Profit!!I'll startooooooooooooooooooc. ...... ooooooooooooookKKKK'. ..'; oooooooooooooo0X0KK...;:lddxOx ooooooooooooookX0KO,xkdoxdoo0,.. oooooooooooooodX0KNOodkxdodO;.. . .. oooooooxOOOOOOONKKxxxxoodO0OkOOkxdl,.. .oooookKOxxxkOOOKNK00OOO00OkxxxxxxxxOk'..ooooOKoodxxxxxxkOOOOkxxxxxxxxxxxxxxxx0..ooodXxlxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxK; oookXxxxxxxkkkxxxxxxxxxxxkxxxxxxxxxxx0c.oooxXxxxxxxxkk0k0OOkkk0OOkkkxxxxxxxxxK;.ooookKxxxxxkxdOdOkkxdo0oxkxxxxxxxxxxOd. oooooO0xxxxxxxxxOxkkkxxxxxxxxxxxxxx0d. ooooookKkxxxxxkOOkkkOkkxxxxxxxxxxOO:. .ooooooodk0OxxxkkO00OkkxkxxxxxxxOk:... ooooooooooOKkxxxxxxxxxxxxxxxxkO;. . oooooooooookKxxxxxxxxxxxkkkkk0. oolllcccc::ck00O0OO0O00KOkkk0d ;;:c::ll:;cllc;..... . ,....

Posted by Firebert010 9 years ago


Robot Ascii Art

.................................................................................................... .................................................................................................... .................................................................................................... .....................................................?DMMMMMMM...................................... .............................................IMNI++++++++++++M7M.................................... ............................................7++++++++++++++++M++M................................... ............................................+++++$MMM8+++++++$?++M.................................. ...........................................++++++++M$MM$++++++D++MN................................. ..........................................MM++ODMI+8Z+NM++++++M++ZOD................................ .........................................,ZD++M7OM+M$$ZM++++++M+NZZ8Z...........,................... ...............................MMM7~....~MZZ+++Z+++++?++++++++N+MZZZM+,............................. .........................................:ZZ++++++++++$MMMD$++O+DZZM,............................... ..........................................MZ++MMMD7+++++++++++I$+MMM................................ ...........................................8+++++++++++++++++++D+++D................................ ...........................................8+++++++++++++++++++M+++$................................ ...........................................D+++$NM7????8NI???7NMO++?................................ .........................................8MM$?????????????????????MN................................ ......................................D?????????????????????????????M............................... ...................................8??????????????????????????????????,............................. .................................,?????????????????????????????????????M............................ ................................8???????????????????????????????????????M........................... ...............................M?????????????????????????????????????????M.......................... ..............................M??????????????????????????????????????????M.......................... .............................M???????????????????????????????????????????M.......................... ............................M7???????NMMD?????MMM8?????$MMM??????????????MM8........................ .........................8$M????????MIIIIZ???MIII8????7MIIM??????????????M++M....................... .......................I8MN?????????M8IIN7???OMNNM?????7DDM??????????????MIM+N...................... ......................M+++I??????????MIID?????MMM???????MM???????????????M++++M..................... .....................M++++???????????????????????????????????????????????M+++++M.................... ....................M++++M???????????????????????????????????????????????M+++++7.................... ...................M++++87??????I7??II?????????????????????7?????????????M++++++M................... ..................MMD7INM???????777????????????????I78MMMMMM8????????????8?+++++M7.................. .................MMZ+++N?????????M8ZZZ8NMMMMNDOZZZZOO88DDNND8????????????IZ++++78M.................. ................?.MMOM.M??????????????????????????????????????????????????MZ+?$NMM~................. ................MDZM??~I??????????????????????????????????????????????????MNMMM8N$M................. ..................7~DMM???????????????????????????????????????????????????M~N.MM:M$................. ......................M???????????????????????????????????????????????????M8MN?7I~.................. .....................+Z???????????????????????????????????????????????????M......................... .....................M????????????????????????????????????????????????????M......................... .....................MMNOI????????????????????????????????????????????????M......................... .....................M?88???????IOMMNZI???????????????????????????????????M......................... .....................MMDI???????M7????????7DMMMMNOI??78NMMMMMMMMMNDOZ$$$ODM......................... ...........................,MMMMNZ???????????ZZ??????????????M????????????M......................... .............................I++++++MMM,7MMMMD7???????????????????????$DMI.......................... .............................D++++++++MN.........M++++?7DMMM~....................................... .............................MMMMMMMMMMM.........8++++++++?M........................................ .............................MMDI+++??NM.........MMMZOMMMMMM........................................ .............................MN$+++++++M........~M+?I7$DMMMM........................................ .............................M+++++++++M........I+++++++++78........................................ .............................+MMMMND88NM........O+++++++++7+........................................ .............................ZI=ZMMMMMN.........O+++++++++N7........................................ ............................M=D+MMMMMM=M........,M?+++++++M:........................................ ............................=I=M..MMMM+$=........:MZ$MMMMMI......................................... ............................=I==M...?M=?8.......MI=DMMMMMM.......................................... ............................7=NM+=Z8M==?.......7$=M=M,ZM?MM......................................... ..............................M$=====?M........M==IM..DM=MM......................................... .....................=.MMMMMN8I=~::~?N......:=.MZ=M$$MM+=MM:.....:IONMMMMMMZ........................ .................................................N===DN8==MM$M$..................................... ...................................................DMM8MMM.......................................... .................................................................................................... .................................................................................................... .....=77777777777777777777777777777777777777777777777777777777777777777777777777777777777777?....... .....=7777.777777777777?777777777777777777I7777777..7777.I7777777777777777777777777777777777?....... .....=7777.77.?.=77..+:..,I.=.7.77.77=..7...77..+7....77.I77..77I..I7777,..7:..?7....7..7777?....... .....=7777.77.7?.7..I77.?7I.777.77.7..777I.777I+.7..7..7.II.==.7..77777..77,.77.I..7..7,.777?....... .....=7777.77.7?.777..7.?7I.777.77.7..777I.77.77.7..7..7.II.777777.~7~7..77,.77.7..7..7:.777?....... .....=7777+77+7I+77:=77I:=7+777=:7+77I:+77~:77:7+77~:I77+777~:I7?:+77.77~.:7?.,77::7::7=:777?....... .....~77777777777777777777777777777777777777777777777777777777777777777777777777777777777777?....... .................................................................................................... ..........=:.I...?...,.+.,~...I.~..I...,..+.I..:.....I......?..=..?.I..I~...+...+....I.............. ..........=:.7....=I...=.:~...I.,...=..,.,+.I..:.I....+......I.=..+.+.I.,..+~...+....I.............. .................................................................................................... .................................................................................................... .................................................................................................... ....................................................................................................

Posted by Arbitror 8 years ago


The Derinsleep ASCII Signature Orders

As you know,n8man makes signatures that are unique. I also began making signatures from ASCII letters. Ask me to have them made.I can also provide them in .jpg or animated .gif form.

Posted by Derin 9 years 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... }

Asked by theredbryophyte 2 years ago


I will give out Homers!

I am giving Homers to EVERYONE,and here are the options:PEOPLE THAT ORDERED:BartboyAnarchistAsiannote:this started off in the chatroom

Posted by Derin 9 years ago


U can talk underwater!

You heard it right,bro.Here is how I did it in ascii art: | Pool SurfaceV~ o Me --> XD

Posted by Derin 9 years ago


On the Origin Of The Universe (or at least our part of it...)

In the course of a conversation in the chatroom, I triggered myself to go look up old RFC's. I found http://www.faqs.org/rfcs/rfc-sidx1.html . It's kind of like stumbling across Moses' chicken-scrawled first drafts of Genesis...A couple of selected quotes,From RFC-6 (A Conversation with Bob Kahn), "BB&N is prepared to convert 6, 7, 8, or 9 bit character codes into 8-bit ASCII for transmission and convert again upon assembly at the destination IMP." So ASCII was not a standard data protocol yet.From RFC-82 (Network Meeting Notes), "ARPA will not pay for the coffee and pastry being served, so please chip in to help me pay for it."[Edit 23 Jul 2009: Fixed URL above to eliminate spurious period.]

Posted by kelseymh 8 years ago


How do I preset a 4029 counter?

Hi all. I am having trouble finding how to preset the minimum output of a 4029. Meaning that I want it to start at an output of 5 (0101) and count up to 15 (1111) and then have it start counting at 5 again. My project is an ASCII counter to check that the ASCII displays with 7 bit binary inputs that I have are functioning correctly and I want to use the 4029 as my input. The problem that I am having is possably misinterpreting the data sheets but is seems that in order to preset the input, the preset pin has to be HI but to run, it has to be LO. Does this mean that I have to set the prest HI, input my preset value of 5, and then bring it LO again to run?   Any help would be appreciated. Thank you much in advance. 

Posted by professorred 5 years ago


Serial terminal emulation help, please? (again...) Answered

Before you read below, read this: https://www.instructables.com/answers/Updating-1980s-X-Terminals/ I've finally gotten around to setting up PuTTY to work with the serial line. Communication is fine, I'm pretty sure I have the baud rate and everything set up correctly, but I still have one problem. The POS program has a login phase, which works perfectly. However, right after the program itself starts and finishes spitting out its splash screen, copyright information, etc., problems start emerging. Putty doesn't seem to be rendering formatting correctly, or maybe not at all. Whenever text needs to be highlighted, or there need to be shape characters like ┌, or ┤, all I see in the window is garble like this: ae&ae&ae&ae&. Also, no line breaks are given. How should I fix this? Should I change a specific setting in PuTTY? Should I be using a different program? ***More information about the original terminal, more specific examples and screen-shots will supplied shortly.*** Kind-of update: Wait, what? So apparently, those two characters above give the same garble on html as on the terminal. They are supposed to be ASCII characters 218 and 195. Note that these are part of the extended ASCII codes (I just realized that). Does PuTTY have an option support ASCII characters 128 to 255? In the character encoding pane of PuTTY setup, I've tried every encoding available. Do I need to type in a name of an encoding manually?

Asked by aelias36 7 years ago



How does one make pull out list in HTML? Answered

For example, there's a list of links down the left hand side, when you hover over it more links pop out the side. I'll try explain in ASCII: [Text] [Text] > [Text] [Text]    [Text] [Text]    [Text] >[Link]               [Text]   [Link]                           [Link] A link to a website with this featured on it would be fine, just so I can go view source.

Asked by Kryptonite 8 years ago


How do you use special characters in cmd?

I'm looking for the arrow (or triangle) symbols to put into a batch program. I know the alt # codes, but I want the codes compatible with ANSI. I have the down arrow, but it's an invisible symbol. Anyone know how to get them? (ASCII numbers are 16, 17, 30, and 31) Thanks!

Asked by race.freak 5 years ago


How does dialup work?

Hello. I am currently working on making my own dialup BBS, but seem to have run into a problem. See, I understand how the raw data is sent over the phone line (FSK, and how 56k basically uses an ADC with a DAC together, and outputs according to the PSTN sample rate). However, there are some things which I have specific questions about.First, when data is communicated between a BBS host and a BBS user, how is the text sent? If I recall correctly it just uses ASCII characters. Is this correct? How does it handle the login input and similar functions?Second, could someone please explain how the modem handshake process works? I have seen a photo explaining the various parts, but I don't completely understand it. See this photo to see the photo I am referencing: https://i.imgur.com/Q3lKIr1.jpg Lastly, could someone please explain trellis modulation (TCM) for dummies?I was lead to believe that a BBS does use ASCII characters to transmit data, due to a video where someone used a text terminal, along with a mode, to connect to his BBS.

Asked by Ruby Laser 5 months ago


Are there any inexpensive ways to make a material flex/contract when an electrical current is applied to it? Answered

I'm working on a small-scale prototype toy and it would be nice to have the ability to apply a charge to a piece of material and have it flex or contract. I kind of see it working a bit like a mechanical solenoid (and that is a possible option here although they would have to be tiny!) in that if the material looks like ____________ to begin with, when you apply a charge to it it becomes like __/\__ (excuse the poor ascii art!)

Asked by ProfessorFalken 7 years ago


What are the best examples of fails, stupidity, and general ignorance that you have witnessed?

I was browsing ibles yesterday, and I came across this stunning piece of stupidity: Person 1: "d - b" (some interesting ASCII art) Person 2: "How do u get the backwards b" Me: "It's called D" It got me thinking afterwards that I should make this forum. So, what are the best examples of fails, stupidity, and general ignorance that you have witnessed?

Posted by The Jamalam 8 years ago


my acekard 2i wont show text for anything

When i checked the system files it showed the system files as glitched ascii and also i couldnt check the files until 10 minutes later because " J:/  Is not acsessible because you do not have premission" or something like that after it let me do something to it i reinstalled AKAIO(acekard all in one) and the problem was fixed anyone know what might have happened? also whenever it happens acekard wont load and i have to reinstall AKAIO have a look.

Asked by GASSYPOOTS 6 years ago


Latest version of Instructables now running

We released a new version of Instructables last night with a bunch of cool things: New footer with links to the blog, newsletters, and store Newsletter archive When you reply to a comment, everyone upstream in the nested comments gets a notification Spell checker Non-ASCII characters stripped from human-readable URLs Carriage returns are no longer stripped from personal messages Only 50 orangeboard posts on /you making the page load faster And a bunch of other changes and additions under the hood making the site better and easier for us to manage. Have fun, and let us know what you think!

Posted by ewilhelm 10 years ago


2WIRE / WiFly Issue

Have WiFly Shield, Uno, 0022, current libraries. 2WIRE router is set WEP-open DHCP: On. Am Using gateway.2WIRE.net and IP scanner to check connection. Cannot get WiFly to associate/connect. I have the Roving WiFly GSX manual and tried dozens of configurations to no effect. The only thing not working is the acceptance of the WEP encryption key. 2WIRE has a 10 ASCII key while Roving requires a 13 ASCIIt key I get the following message: Set security phrase to xxxxxxxxxx (my 10 digit code) set wlan key xxxxxxxxxx Bad len=10 ERR: Bad Args Any way around this?

Posted by tedlawson 6 years ago


Cannot get WiFly to associate/connect to 2WIRE Router.

Have WiFly Shield, Uno, 0022, current libraries. 2WIRE router is set WEP-open DHCP: On. Am Using gateway.2WIRE.net and IP scanner to check connection. Cannot get WiFly to associate/connect. I have the Roving WiFly GSX manual and tried dozens of configurations to no effect. The only thing not working is the acceptance of the WEP encryption key. 2WIRE has a 10 ASCII key while Roving requires a 13 ASCIIt key I get the following message: Set security phrase to xxxxxxxxxx (my 10 digit code) set wlan key xxxxxxxxxx Bad len=10 ERR: Bad Args Any way around this?

Asked by tedlawson 6 years ago


If I use the serin command where is the serial data stored? Answered

 I am trying to get a GPS module outputting NMEA sentences in ASCII through a serial port to to store it's once per minute output in my picaxe 18X. From here i hope to read these sentences and using a look up table assign each letter or number that has been read a morse code form. This will then be sent to a 433mhz radio module and received on a scanner. I have programmed standard pics before but only using standard inputs and don't really understand where or in what form variables are stored on the picaxe chip so am therefore a bit confused as to how to go about using the serin command. Thanks for any help!

Asked by harrier07 8 years ago


Reading a 16x2 LCD screen

Dear Techfreaks, I have a rather technical question for you guys. I have a big, company-suited coffee machine which I'd like to mod, to be internet connected. My idea is to read the LCD screen of the machine, by intercepting the wires, and interpreting the signals with a microcontroller. I'd need to read the data, and convert it into ASCII, so I can drop them on a website, and in fact have a (sort of live) view of the LCD.  The used LCD is a standard 16x2, 16-pin LCD. Does anyone have any experience with doing this? Or any tips? I couldn't find a project online which wanted to do the same thing as I did. Thanks in Advance, Willem. 

Posted by WillemB14 2 years ago


Idea for 3D stereo camera attachment

I just discovered "Stereophotography" images on flickr and I came up with an idea for how you could make an attachment (that might work on any camera) to take 3D photographcs.Using 4 small mirrors I think you could seperate and then combine two images. Here's an ASCII art of my idea: (top view) [CAMERA] [] So you can see (hopefully) that the two inner mirrors meet at the middle of the camera' lense and combine the images coming in from the two side mirrors. So in the end you get a photo comprised of two side-by-side images about 4 or 5 inches apart....and hopefully would give a 3D effect. (when eye's crossed, of course)What do you think? Have you seen anything like this before?

Posted by jimbox31 11 years ago


ttl output (binary) barcode reader module

Hello there;  I am working my final year project on library management system which needs to include a barcode reader hardware. As i am told by my advisor i can't use a barcode reader whose out put is the final ASCII value rather i have to get a binary (0 & 1s)output from my hardware, then convert that value using arduino or my C# asp.net code to generate the final result of the barcode for the book.   So, what is a looking for is, a ccd camera based barcode reader module whose output is ttl (or binary) i.e before it is decoded.  Any idea where i can find such a device, please   Any comment is welcome.  10x for your time.

Posted by Hailye 1 year ago


How do I overwrite the python3 code? Answered

Hi, when I try to copy and paste the final code from the python3 IDLE to the python2 IDLE and run it, it comes up with an error message saying "Non-ASCII found, yet no encoding declared. Add a line like # -*- coding: utf-8 -*- to your file. Choose OK to save this file as utf-8." and gives me two opptions "Ok" or Edit my "file". Is this the proper error message and how do I overwrite the python3 code? If I choose "Edit my file" and try to add the line of code, it still wont let me save the file and comes up with the same error message. If I choose "Ok", when I try to run the file again, it comes up with an invalid syntax error message about the first quotation mark in the "published" line. Why does this happen and how can I solve this?

Asked by Pie_King101 12 months ago


Tiny portable printer - Will pay

Hello everyone. I need someone to come up with the plans or the finished product of a really small portable printer around the size of a Galaxy SII (or iPhone) but twice the height (thickness) at most. It must be able to print on a strip of paper about 2-6cm wide. It must be able to print a dot-matrix like text. The size of the text must be somewhat adjustable. It must print ASCII characters and maybe some symbols. The line of text to be printed will look like this: ID0001||25AUG{}12:55 No need for paper feeding or anything. It should operate like: place the paper in the tray, press a button/buttons, remove the paper. The ink should last for at least ten prints before replacing and the device must have a rechargeable battery. I would prefer if you make an instructable out of it as well but it is not mandatory. If you can deliver kindly send me a private message here with your offer.

Posted by izybit 5 years ago


Topic/comment editing -- HTML entities not handled correctly

I've been updating one of my forum topics today, and I have seen some annoying bugs in the handling of HTML entities and special characters.In the original topic text, I made use of three HTML entities (&...;): the open and close square brackets (numeric entities #91 and #93) and the Greek letter mu (entity "micro"). In the initial posting, all these entities are translated correctly. What I have seen is that if I then "Edit Topic", the text is not "inverted" correctly: The entities are preserved as their corresponding ASCII characters. For the square brackets, which I had entered as entities specifically so they would not be interpreted as signaling a hyperlink, that interpretation occurs and messes up my text. For the micro entity, a sequence of invalid additional characters (angstrom and question mark) get prepended to it on each edit/publish cycle.Obviously I can (and did, half a dozen times) go through and re-repair all of these mistakes, but it's pretty annoying :-(

Posted by kelseymh 9 years ago


Arduino Mega with Sim900

Recently I bought Sim900a module and Arduino Mega 2560 to run my old code for sending sms and call, but now there is a problem as I am unable to send sms or either call, my code is attached below. #include SoftwareSerial gsm(2,3); void setup() { gsm.begin(9600); // Setting the baud rate of GSM Module Serial.begin(9600); // Setting the baud rate of Serial Monitor (Arduino) delay(100); } void loop() { if (Serial.available()>0) switch(Serial.read()) { case 's': Send(); break; case 'r': Recieve(); break; case 'S': Send(); break; case 'R': Recieve(); break; } if (gsm.available()>0) Serial.write(gsm.read()); } void Send() { Serial.print("Sending"); gsm.println("AT+CMGF=1"); delay(1000); gsm.println("AT+CMGS=\"+xxxxxxxxxxxx\"\r"); // Replace x with mobile number delay(1000); gsm.println("Hello I am GSM modem!!!");// The SMS text you want to send delay(100); gsm.println((char)26); // ASCII code of CTRL+Z delay(1000); } void Recieve() { Serial.print("Receiving"); gsm.println("AT+CNMI=2,2,0,0,0"); // AT Command to receive a live SMS delay(1000); }

Posted by vicky58911 10 months ago


Xbee interfacing -Need to send PIR sensor value and Gas sensor value from Tx end to Rx end.Read details for further info

Hi all, I am building a robot for my project and currently i am facing some issues with it.. Hope someone could help me resolve it. ! Thanks in advance for your help and support !! :-) Detailed specs : First of all i use 3 arduino - 1 at TX (user end) and 2 at RX (Bot side). Now , I am using a PIR (Human motion detection ) Sensor and Gas sensor at  Rx(Bot side).  The issue i am facing is , I am not able to send the Values read by both the sensors to the User end though xbee.. However the sensor is reading the values properly in Bot side , but iwhen sent to the User end i am getting the values as '-1' or the ASCII value of the Corresponding sent sensor value. Now the help i need is.. I need someone (If possible) to send the code where  1.A transmitter Code where you read the PIR,Gas sensor value and transmit the value through xbee. 2. A receiver code  where in you read the values that are sent through a xbee. Kindly Help.. Thanks in advance ! :-) Regards, Gireesh.S

Asked by gsuresh1 2 years ago


Remote control cars over the internet (UPDATE)

Thanks to everyone on the original topic of RC cars over the internet. I came across this site with 2 RC cars that can be controlled freely over the internet. rajesh.homelinux.org/  I will be using an arduino connected to a computer (Host) via USB. The host computer will be running a clean copy of ubuntu 9.10. But I need help on the following.. - What to program onto the arduino - How to get the host talking to the arduino - How to receive commands from a client (you) and then to the arduino - What needs to be done to a basic webpage for you the client. - How to host a webpage some of this stuff I already know but advice will be helpful. the live webcam feed can be run on any provider that runs at fast frame rates. Red5 might be an option since the site on top uses it. Here is what Letapjar, one of the site mods on the RC-Carduino sites had to say. "Hi folks, I'm one of the site mods at the RC-Carduino site .  A couple of quick things: 1) we use an arduino b/c it was the quickest/easiest way to get the webserver talking to the micro-controller (and it's only $30 for a dedicated arduino for this project - this is  a long term project for us so $30 is a small investment) 2)remote server is no problem - just forward the HTTP requests to the local machine that's connected to the arduino. 3)here's a link to the code to talk to the arduino from another program: http://todbot.com/blog/2006/12/06/arduino-serial-c-code-to-talk-to-arduino/ in ubuntu make sure the apache user is part of the 'dialout' group to talk to the serial port. - another option is to use a serial proxy as described on the arduino.cc website. (we haven't tried that yet).  Design a simple protocol (ours uses single ascii characters for each movement direction - easy and we can use a switch/case statement to interpret them quickly on the arduino)" Happy Hacking sorry but I still don’t understand what to do.. And, I really am a newbie on the arduino stuff.

Posted by physics_dude 8 years ago


Strange problems with the mouse and keyboard? Answered

Must be bad karma for the new year but both my mouse and my keyboard are playing games with me on the PC. Of course they are wireless, mouse is a Logitech, keyboard some very old Aldi brand. After many years of good service they started to fail at the same time. And yes, I tried fresh batteries several times with no luck ;) Here are the current symptoms: 1. Keyboard Randomly keys I press fail to show up although the blinking on the receiver indicates an action was received. When typing a bit faster, and for me that is the two-finger-best-hope method a lot gets lost. My speed is slow enough to make a bad typist laugh in tears LOL In some rare cases I also get totally wrong results, usually somethe graphical character that otherwise need and ascii input to appear. 2. Mouse At times when the keyboard plays up the little rodent does the same. Here it means the pointer disappears or moves in jumps. Also mouse clicks on let's say a tab in the bowser often grab the tab or are not registered at all. It is now starting to annoy me, mainly bcause I failed to rectify this problem in any good way. Only system change in or before the problems started was the usual Windows 7 monthly update, but that came about a week before it all started. To make things worse the mouse uses Logitechs old wireles tech while the keyboard is in a totally different frequency and as said dirt cheap. I also fail to replicate the problem consistently or find a common cause. Funny thing: If used on my old Nexus tablet both perform just fine even from over 5m away. Would love to hear some thoughts on things to try or check... But so you know: Tried the drivers, different ports relocating the receivers and even a rollback of Windows to a state from Nov last year. Everything else connected to the USB ports performs fine. Am at the stage where I even accept weird things to try, so fire up please!

Asked by Downunder35m 6 months ago


arduino Blimp

Hey guys. I'm building an RC Blimp right now and i want to add an autonom landing feature which means the blimb has to realise when there is no more serial communication through the xbee. right now the aircraft gets 3 char-type objects. ech of these 3, for example "1=#" represents the speed for one motor. the 3 ASCII symbols get send every 0.1 seconds. any ideas how the arduino can realise that the connection is interrupted?  heres my code, thanks for helping me out:) #include #include "Wire.h" #include "SRF02.h" /*Testprogramm zur Treiberprogrammierung Team Grün*/ SRF02 srf02[2] = {   SRF02(0x70, SRF02_CENTIMETERS), //Initialisierung der beiden Ultraschallsensoren   SRF02(0x71, SRF02_CENTIMETERS), }; unsigned long nextPrint = 0; //------------------------------------------+ Servo servoLeft; // create servo object     | Servo servoRight;//                         | Servo servoYaxis;//                         | //------------------------------------------+ int motorSpeed; int verticalSpeed; int pinGreen = 8; //rgb colors int pinRed = 4; int pinBlue = 7; int ledPin = 2; int signal = 0; void setup() {   //--------------------------+   Serial.begin(9600);//     | Serial   Wire.begin();//           | Ultraschallsensor   SRF02::setInterval(100);//| Pulsintervall   //-------------------------+   //Servo Liste   servoLeft.attach(6);   servoRight.attach(5);   servoYaxis.attach(9);   char str[4] = {     '\0'  };   char command[3];   int a;   pinMode(pinGreen, OUTPUT);   pinMode(pinRed, OUTPUT);   pinMode(pinBlue, OUTPUT);   pinMode(ledPin, OUTPUT); } void loop() {   char str[4] = {     '\0'  };   int a;   int j = 0;   int mL, mR, mY;   if (Serial.available()>=3){     for (byte i=0; i       a = Serial.read();       if (j == 0){         mL = a;       }       if (j == 1){         mR = a;       }       if (j == 2){         mY = a;       }       j++;     }     if(mL == 181){       Serial.println("Recived Command:");     }     else{       Serial.println();       Serial.println("MotorValues:");       Serial.println(mL);       Serial.println(mR);       Serial.println(mY);       Serial.println("------------");       servoLeft.write(mL);       servoRight.write(mR);       servoYaxis.write(mY);       //---------------------------------_-:+*COLOR*+:-_-------------------------------       if(mL==90&&mR==90&&mY==90){         //show zeropoint         digitalWrite(pinBlue, LOW);         digitalWrite(pinRed, LOW);         digitalWrite(pinGreen, LOW);       }       if(mL         digitalWrite(pinBlue, LOW);         digitalWrite(pinRed, HIGH);         digitalWrite(pinGreen, HIGH);         }       if(mL>mR){         digitalWrite(pinGreen, LOW);         digitalWrite(pinRed, HIGH);         digitalWrite(pinBlue, HIGH);         }       if(mL==mR&&mL!=90){         digitalWrite(pinBlue, HIGH);         digitalWrite(pinRed, LOW);         digitalWrite(pinGreen, LOW);       }       if(mY!=90){         digitalWrite(pinBlue, LOW);         digitalWrite(pinRed, LOW);         digitalWrite(pinGreen, HIGH);       }                 }   } }

Posted by willi1131 3 years ago


Can't properly flash Attiny85, please help.

I have working proto of a bathroom exhaust fan controlled by methane sensor via arduino uno. I now wish to transfer this sketch to an ATtiny85 (cause i had extras). I have programmed ATtiny before, and can successfully get 'blink' going on this specific MCU. However I cannot get my sensor sketch to work properly... Perhaps I am asking too much of this little guy? I am including my code and video in hopes that someone can steer me in the right direction.  /*   AT85      Arduino    Circuit   0 (PB5)   A0             pin 3 of 50k pot   2 (PB7)   ~9             led or relay     Trim Pot        1              GND   2              GND   3              Arduino (attiny) & Sensor B1     Sensor   A1             +5VDC   H1             GND   GND            GND   B1             Trim Pot 3   */   const int numReadings = 10;    // average sensor reading used from 10 samples int ledPin = 1;                  // replaced ac/dc relay with led to debug int readings[numReadings];      // the readings from the analog input int index = 0;                  // the index of the current reading int total = 0;                  // the running total int average = 0;                // the average int inputPin = 0;    //reading from sensor unsigned long start_time; unsigned long current_time; unsigned long elapsed_time; void setup() {   // sets digital pin 1 to output   pinMode(ledPin, OUTPUT);     // sets analog 0 to input   pinMode(inputPin, INPUT);   // initialize all the readings to 0:   for (int thisReading = 0; thisReading     readings[thisReading] = 0;          } void loop() {         // 10 sample average used to prevent false positive from a bounce and/or spike         // subtract the last reading:   total= total - readings[index];           // read from the sensor:    readings[index] = analogRead(inputPin);   // add the reading to the total:   total= total + readings[index];         // advance to the next position in the array:    index = index + 1;                      // if we're at the end of the array...   if (index >= numReadings)                  // ...wrap around to the beginning:     index = 0;                             // calculate the average:   average = total / numReadings;           // send it to the computer as ASCII digits          delay(1000); // delay in between reads for stability                    int threshold = 300;                  // sets the threshold value   if(average > threshold){  // determines if the level of methane breaks threshold         start_time = millis();      // starts exhaust fan on 5 min timer     digitalWrite(ledPin, HIGH);      do  {       current_time = millis();      // defines the 5 minute timer       elapsed_time = current_time - start_time;     }     while(elapsed_time   }     if(average       digitalWrite(ledPin, LOW);  // fan turns off if sensor value below threshold     }                             // or stays on until it is below threshold     } http://youtu.be/cm_uuEXd8HM thanks in advance!

Asked by earthtown 5 years ago


Need help with Code to control servos with an Arduino?

The code will compile but when I connect the servos I start getting errors on the serial port. any help on this would be great #include   Servo myservo;  // create servo object to control a servo Servo myservo2; // a maximum of eight servo objects can be created   int pos = 90;    // variable to store the servo position   // set a variable to store the byte sent from the serial port int incomingByte;   void setup() {   // start sending data at 9600 baud rate   Serial.begin(9600);   myservo.attach(9);    // attaches the servo on pin 9 to the servo object   myservo2.attach(10);  // attaches the servo on pin 10 to the servo object }   void loop() {   // check that there's something in the serial buffer   if (Serial.available() > 0) {     // read the byte and store it in our variable     // the byte sent is actually an ascii value     incomingByte = Serial.read();     // note the upper casing of each letter!     // each letter turns a motor different way.        // start of left laser sweep, moving left 90 degrees.     // arrow laser spins and points to left.     if (incomingByte == 'L') {     Serial.println(incomingByte);         myservo2.write(180);                         // send servo 2 to the 180 degree position and stay     for(pos = 180; pos > 90; pos -= 1)  // goes from 90 degrees to 180 degrees   {     // in steps of 1 degree     Serial.println(pos);     myservo.write(pos);    // tell servo to go to position in variable 'pos'         delay(15);                       // waits 15ms for the servo to reach the position   }     for(pos = 90; pos     // goes from 180 degrees to 90 degrees   {                                    myservo.write(pos);              // tell servo to go to position in variable 'pos'     delay(15);                       // waits 15ms for the servo to reach the position     }     }             // start of right laser sweep, moving right 90 degrees.     // arrow laser spins and points to right.         if (incomingByte == 'R') {      Serial.println(incomingByte);      Serial.println(pos);     myservo2.write(0);                          // send servo 2 to the 0 degree position     for(pos = 0; pos   // goes from 90 degrees to 0 degrees   { Serial.println(pos);                                 // in steps of 1 degree     myservo.write(pos);              // tell servo to go to position in variable 'pos'     delay(15);                       // waits 15ms for the servo to reach the position   }     for(pos = 90; pos>=0; pos-=1)     // goes from 0 degrees to 90 degrees   { Serial.println(pos);                                   myservo.write(pos);              // tell servo to go to position in variable 'pos'     delay(15);                       // waits 15ms for the servo to reach the position     }     }         // if a S is sent make sure the servos go to 90 degrees     if (incomingByte == 'S') {     Serial.println(incomingByte);     Serial.println(pos);     myservo2.write(90);     myservo.write(90);                              }   } }

Asked by DonC_WSU 7 years ago


about button....

I have code on vb.net that will turn on led on my arduino but how can i turn it if i want to add button? how can i add button here in my code? #include int ledPin = 13; int buttonPin = 2;  // the number of the pushbutton pin      // the number of the LED pin int buttonState = 0;  // variables will change: LiquidCrystal lcd(12, 11, 5, 4, 3, 2); void setup() {   Serial.begin(9600); // set serial speed   pinMode(ledPin, OUTPUT); // set LED as output   digitalWrite(ledPin, LOW); //turn off LED      //   //         lcd.begin(16, 2);           lcd.setCursor(0,0);         lcd.print("     DaNeiL");          lcd.setCursor(0,1);         lcd.print("GASOLINE-STATION"); } void loop(){   while (Serial.available() == 0); // do nothing if nothing sent   int val = Serial.read() - '0'; // deduct ascii value of '0' to find numeric value of sent number     int buttonstate = Serial.read();       buttonState = digitalRead(buttonPin);   if (buttonState == HIGH) {         digitalWrite(ledPin, HIGH);     Serial.println("PLEASE WAIT WHILE REFUELING"); Serial.print('\n');     delay(9000); digitalWrite(ledPin, LOW);    // turn the LED off by making the voltage LOW     Serial.println("price 40");     Serial.print('\n');     Serial.print('\n');     Serial.println("liters 1");     }   else     // turn LED off:   if (val == 1) { // test for command 1 then turn on LED     Serial.println("P20.00                    1/2");     delay(10);     digitalWrite(ledPin, HIGH);// turn on LED      lcd.clear();      lcd.setCursor(0,0);      lcd.print("PRICE=  P20.00");      lcd.setCursor(0,1);      lcd.print("MILLILITERS=500");         }         {     Serial.println("P40.00                      1");     delay(10);     digitalWrite(ledPin, HIGH); // turn off LED      lcd.clear();      lcd.setCursor(0,0);      lcd.print("PRICE=  P40.00");      lcd.setCursor(0,1);      lcd.print("MILLILITERS=1000");       }   if (val == 3) { // test for command 1 then turn on LED     Serial.println("P80.00                      2");     delay(1000);     digitalWrite(ledPin, HIGH);// turn on LED      lcd.clear();      lcd.setCursor(0,0);      lcd.print("PRICE=  P80.00");      lcd.setCursor(0,1);      lcd.print("MILLILITERS=2000");       }   else if (val == 4) // test for command 0 then turn off LED   {     Serial.println("P120.00                      3");     delay(1000);     digitalWrite(ledPin, HIGH); // turn off LED      lcd.clear();      lcd.setCursor(0,0);      lcd.print("PRICE=  P120.00");      lcd.setCursor(0,1);      lcd.print("MILLILITERS=3000");       }       if (val == 5) { // test for command 1 then turn on LED       Serial.println("P160.00                      4 ");       delay(10);       digitalWrite(ledPin, HIGH);// turn on LED        lcd.clear();      lcd.setCursor(0,0);      lcd.print("PRICE=  P160.00");      lcd.setCursor(0,1);      lcd.print("MILLILITERS=4000");         }     else if (val == 6) // test for command 0 then turn off LED     {       Serial.println("P200.00                      5");       delay(10);       digitalWrite(ledPin, HIGH); // turn off LED        lcd.clear();      lcd.setCursor(0,0);      lcd.print("PRICE=  P200.00");      lcd.setCursor(0,1);      lcd.print("MILLILITERS=5000");         }       if (val == 8) { // test for command 1 then turn on LED     delay(10);     digitalWrite(ledPin, LOW);// turn on LED     lcd.clear();      lcd.print("     DaNeiL");          lcd.setCursor(0,1);         lcd.print("GASOLINE-STATION");       }           if (val == 9) { // test for command 1 then turn on LED     delay(10);     digitalWrite(ledPin, HIGH);// turn on LED     lcd.clear();      lcd.print("    FULL TANK");      lcd.setCursor(0,1);      lcd.print("PLEASE WAIT....");       }            if (val == 0) { // test for command 1 then turn on LED     delay(10);     digitalWrite(ledPin, LOW);// turn on LED                }   else if (val == 12) // test for command 0 then turn off LED   {     delay(10);     digitalWrite(ledPin, HIGH); // turn off LED           }   else {     }     }

Posted by NeilV2 3 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; } } }

Asked by WWC 5 years ago


A advanced Arduino calculator?

So I thought about a new project: make an "advanced" calculator since online there are plenty of tutorials of simple ones. I have done already the circuit and I have only some problems with the code since this is only my third project on Arduino and I don't  know programming in C. So basically: when I switch on the device it shows me a long text which I can scroll using a pair of pushbuttons(when the text can't scroll anymore a led switches on). When I push them contemporanealy the device switches to calculator. And this is the code I made (I know there are plenty of errors): #include #include long num1,num2 ; double total; char operation,button; const byte ROWS = 4; const byte COLS = 4; char keys[ROWS][COLS] = {   {'1','2','3','+'},   {'4','5','6','-'},   {'7','8','9','*'},   {'C','0','=','/'} }; byte rowPins[ROWS] = {A0,A1,A2,A3}; //connect to the row pinouts of the keypad byte colPins[COLS] = {A4,A5,0,1}; //connect to the column pinouts of the keypad Keypad customKeypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS); // === CONSTANTS AND GLOBALS === // -- PINS -- const int PIN_LCD_LED = 6;  // analog const int PIN_ERR_LED = 7;  // digital const int PIN_BUTTON1 = 8;  // digital const int PIN_BUTTON2 = 9;  // digital // -- LCD -- // PIN 12   -> RS // PIN 11   -> Enable // PINS 2-5 -> D4-7 LiquidCrystal lcd(12, 11, 2, 3, 4, 5); // number of columns in the LCD const int LCD_COLS = 16; // LCD brightness [0, 255] const int LCD_BRIGHTNESS = 128; // LCD ON or OFF int state_lcd = LOW; // start position for text int lcd_start = 0; // -- LED -- // LOW -> LED is OFF - HIGH -> LED is ON int state_led = LOW; // stores time when turned LED on unsigned long t0_led; // timeout to turn the LED off const int LED_TIMEOUT = 500; // -- text to print -- // ASSUMPTION: text always longer than LCD_COLS, if not add a check in loop const char TEXT[] = "After trying Helloworld I made this more advanced version..."; const int TEXT_LEN = (sizeof(TEXT) / sizeof(char)) - 1; const int LCD_LIMIT = TEXT_LEN - LCD_COLS; // === CONSTANTS AND GLOBALS END === // === INITIALIZATION === void setup() {   // -- SET DIGITAL PINS --   pinMode(PIN_BUTTON1, INPUT);   pinMode(PIN_BUTTON2, INPUT);   pinMode(PIN_ERR_LED, OUTPUT);   // -- SET UP LCD --   lcd.begin(16,2);   lcd.noDisplay();   digitalWrite(PIN_LCD_LED, state_lcd);   // ERROR LED is off when starting   digitalWrite(PIN_ERR_LED, state_led);   // -- read buttons --   int state_button1 = digitalRead(PIN_BUTTON1);   int state_button2 = digitalRead(PIN_BUTTON2);     // pushed button 1 -> try to scroll left or turn LED on if can't     if(HIGH == state_button1)     {       if(lcd_start > 0)       {         lcd_start--;         state_led = LOW;         digitalWrite(PIN_ERR_LED, state_led);         delay(200);       }       else       {         state_led = HIGH;         digitalWrite(PIN_ERR_LED, state_led);         t0_led = millis();       }     }     // pushed button 2 -> try to scroll right or turn LED on if can't     if(HIGH == state_button2)     {       if(lcd_start       {         lcd_start++;         state_led = LOW;         digitalWrite(PIN_ERR_LED, state_led);         delay(200);       }       else       {         state_led = HIGH;         digitalWrite(PIN_ERR_LED, state_led);         t0_led = millis();       }     }     // -- print text on the LCD --     for(int i = 0; i     {       lcd.setCursor(i, 0);       lcd.print(TEXT[lcd_start + i]);     }     // ERROR LED is ON     if(HIGH == state_led)     {       unsigned long td = millis() - t0_led;       // LED has been ON for more than LED_TIMEOUT ms. -> turn it OFF       if(td > LED_TIMEOUT)       {         state_led = LOW;         digitalWrite(PIN_ERR_LED, state_led);       }     }   }   // normally 20FPS   // === INITIALIZATION END === // === MAIN LOOP === void loop() {   // == LCD STILL OFF ==   if(HIGH == state_lcd)   {     // pushing both buttons -> turn LCD on     int state_button1 = digitalRead(PIN_BUTTON1);     int state_button2 = digitalRead(PIN_BUTTON2);         if(HIGH == state_button1 && HIGH == state_button2)     {       analogWrite(PIN_LCD_LED, LCD_BRIGHTNESS);       lcd.display();       state_lcd = HIGH;       delay(250);     }   }     else  // == LCD ON ==   {     // Loops are convenient for reading key press from keypad     while(1) // First loop. Here we read keypad and compose our first number. It does so untill we press operation button and break's out of loop or 'C' and it starts from beginning of this loop     {                 button = customKeypad.getKey(); // Button read         if (button=='C') // If user wants to resset while he is writing first number         {           num1=0;           num2=0;           total=0;           operation=0;           lcd.clear();         }                 if (button >='0' && button         {           num1 = num1*10 + (button -'0'); // Our numeric values are 0-9 witch means they are in first decade, when we multiply with 10 we basicaly add zero after number,           // than we add a new number entered to that zero spot. As for (button -'0') this is simple ASCII table "trick" 0...9 in ASCII table are 48 ... 57,           // so by subtracting '0' from any of them we get their value in decade system ex. char '5' = 53 in decade numeric system minus 48 for zero char gives us value of actual 5,           // if our previous number was ex. 25 we get 250 by multiplying it with 10 and then we add 5 and we get 255 witch gets printed on LCD.           lcd.setCursor(0,0); // Select first row on lcd           lcd.print(num1); // Print current number1         }         if (num1 !=0 && (button=='-' || button=='+' || button=='*' || button=='/')) // If user is done inputing numbers         {           operation = button; // operation remembers what mathematical operation user wants on numbers           lcd.setCursor(0,1); // set cursor to row 2           lcd.print(operation); // print our operator           break;         }     }         while(1) // Second while loop, it loops untill user has pressed '=' or 'C'. so it either prints total or ressets program     {         if (button =='C'){break;} // This covers case where user pressed operator and still wants to reset         button = customKeypad.getKey();         if (button=='C') // Making sure user wants to reset at anytime         {           num1=0;           num2=0;           total=0;           operation=0;           lcd.clear();           break;         }         if (button >='0' && button         {           num2 = num2*10 + (button -'0');           lcd.setCursor(1,1);           lcd.print(num2);         }         if (button == '=' && num2 !=0)// If button pressed was '=' its the end of the road. Calls domath() subroutine does calculation and print our results         {           domath();                              break;          }     }     while(1)     {       // After all is done this loop waits for 'C' key to be pressed so it can reset program and start over.       if (button =='C'){break;} // This line is side effect of previous loop since if user pressed 'C' it breaks out of previous loop and continues here.So we need to break this one aswell or user would need to press 'C' 2 times       button = customKeypad.getKey();       if (button =='C')         {            lcd.clear();            lcd.setCursor(0,0);            num1=0;            num2=0;            total=0;            operation=0;            break;         }     } } void domath() // Simple switch case to pick what operation to do, based on button pressed by user. {   switch(operation)     {       case '+': // Addition           total = num1+num2;           break;             case '-': // Subtraction           total = num1-num2;           break;             case '/': // Division. Could add error for division by zero, or change line in second loop where it waits for '=' char to if (button == '=' && num2 != 0) this will halt program untill num2 is not zero and then continue           total = (float)num1/(float)num2;           break;             case '*': // Multiplication           total = num1*num2;           break;               }     // Based on case selected print our total and     lcd.setCursor(0,1);     lcd.print('=');     lcd.setCursor(1,1);     lcd.print(total);       } } // === MAIN LOOP END === Waiting your answers, Cristian

Asked by IlirD2 1 year ago


ITEADLIB_Arduino_WeeESP8266 android response

Im planing to do a project that using Arduino+esp8266 with android device, at first my code was something like this. #include #define DEBUG true SoftwareSerial esp8266(9,10); // make RX Arduino line is pin 2, make TX Arduino line is pin 3.                          // This means that you need to connect the TX line from the esp to the Arduino's pin 2                          // and the RX line from the esp to the Arduino's pin 3 void setup() {   Serial.begin(9600);   esp8266.begin(9600); // your esp's baud rate might be different   pinMode(11,OUTPUT);   digitalWrite(11,LOW);   pinMode(12,OUTPUT);   digitalWrite(12,LOW);   pinMode(13,OUTPUT);   digitalWrite(13,LOW);   pinMode(10,OUTPUT);   digitalWrite(10,LOW);   sendCommand("AT+RST\r\n",2000,DEBUG); // reset module   sendCommand("AT+CWMODE=1\r\n",1000,DEBUG); // configure as access point   sendCommand("AT+CWJAP=\"Arsalan Wifi\",\"arsalan123\"\r\n",3000,DEBUG);   delay(10000);   sendCommand("AT+CIFSR\r\n",1000,DEBUG); // get ip address   sendCommand("AT+CIPMUX=1\r\n",1000,DEBUG); // configure for multiple connections   sendCommand("AT+CIPSERVER=1,8080\r\n",1000,DEBUG); // turn on server on port 80   Serial.println("Server Ready"); } void loop() {   if(esp8266.available()) // check if the esp is sending a message   {     if(esp8266.find("+IPD,"))     {      delay(1000); // wait for the serial buffer to fill up (read all the serial data)      // get the connection id so that we can then disconnect      int connectionId = esp8266.read()-48; // subtract 48 because the read() function returns                                        // the ASCII decimal value and 0 (the first decimal number) starts at 48      esp8266.find("pin="); // advance cursor to "pin="      int pinNumber = (esp8266.read()-48); // get first number i.e. if the pin 13 then the 1st number is 1      int secondNumber = (esp8266.read()-48);      if(secondNumber>=0 && secondNumber      {       pinNumber*=10;       pinNumber +=secondNumber; // get second number, i.e. if the pin number is 13 then the 2nd number is 3, then add to the first number      }      digitalWrite(pinNumber, !digitalRead(pinNumber)); // toggle pin         String content;      content = "چراغ ";      content += pinNumber;      content += " is ";      if(digitalRead(pinNumber))      {        content += "ON";      }      else      {        content += "OFF";      }      sendHTTPResponse(connectionId,content);      // make close command      String closeCommand = "AT+CIPCLOSE=";      closeCommand+=connectionId; // append connection id      closeCommand+="\r\n";      sendCommand(closeCommand,1000,DEBUG); // close connection      Serial.print(connectionID);     }   } } /* * Name: sendData * Description: Function used to send data to ESP8266. * Params: command - the data/command to send; timeout - the time to wait for a response; debug - print to Serial window?(true = yes, false = no) * Returns: The response from the esp8266 (if there is a reponse) */ String sendData(String command, const int timeout, boolean debug) {     String response = "";     int dataSize = command.length();     char data[dataSize];     command.toCharArray(data,dataSize);     esp8266.write(data,dataSize); // send the read character to the esp8266     if(debug)     {       Serial.println("\r\n====== HTTP Response From Arduino ======");       Serial.write(data,dataSize);       Serial.println("\r\n========================================");     }     long int time = millis();     while( (time+timeout) > millis())     {       while(esp8266.available())       {         // The esp has data so display its output to the serial window         char c = esp8266.read(); // read the next character.         response+=c;       }      }     if(debug)     {       Serial.print(response);     }     return response; } /* * Name: sendHTTPResponse * Description: Function that sends HTTP 200, HTML UTF-8 response */ void sendHTTPResponse(int connectionId, String content) {      // build HTTP response      String httpResponse;      String httpHeader;      // HTTP Header      httpHeader = "HTTP/1.1 200 OK\r\nContent-Type: text/html; charset=UTF-8\r\n";      httpHeader += "Content-Length: ";      httpHeader += content.length();      httpHeader += "\r\n";      httpHeader +="Connection: close\r\n\r\n";      httpResponse = httpHeader + content + " "; // There is a bug in this code: the last character of "content" is not sent, I cheated by adding this extra space      sendCIPData(connectionId,httpResponse); } /* * Name: sendCIPDATA * Description: sends a CIPSEND=, command * */ void sendCIPData(int connectionId, String data) {    String cipSend = "AT+CIPSEND=";    cipSend += connectionId;    cipSend += ",";    cipSend +=data.length();    cipSend +="\r\n";    sendCommand(cipSend,1000,DEBUG);    sendData(data,1000,DEBUG); } /* * Name: sendCommand * Description: Function used to send data to ESP8266. * Params: command - the data/command to send; timeout - the time to wait for a response; debug - print to Serial window?(true = yes, false = no) * Returns: The response from the esp8266 (if there is a reponse) */ String sendCommand(String command, const int timeout, boolean debug) {     String response = "";     esp8266.print(command); // send the read character to the esp8266     long int time = millis();     while( (time+timeout) > millis())     {       while(esp8266.available())       {         // The esp has data so display its output to the serial window         char c = esp8266.read(); // read the next character.         response+=c;       }      }     if(debug)     {       Serial.print(response);     }     return response; } but then i chose to use library code for esp8266 and i use this link ITEADLIB_Arduino_WeeESP8266 now i have problem that i dont know how can i get a response message back to my android device, also this is my code using library, (i know its really noobish code cuz im new but... it work atleast :D ) #include #include "ESP8266.h" #include #include LiquidCrystal lcd(12, 11, 5, 4, 3, 2); //moshakhas kardane pin haye LCD SoftwareSerial mySerial(7, 8); // moshakhas kardane pin haye wifi ESP8266 wifi(mySerial); String msg; #define SSID        "Arsalan Wifi"  //UserName wifi #define PASSWORD    "arsalan123"  //Password wifi String pinnum; int count= 0; void setup() {   lcd.begin(20, 4);       Serial.begin(9600);   pinMode(9,OUTPUT);   digitalWrite(9,HIGH);   String IP;   Serial.print("setup begin\r\n");   lcd.print("Connecting to Wifi");   delay(3000);   Serial.print("FW Version: ");   //  Serial.println(wifi.getVersion().c_str());         if (wifi.setOprToStation()) {         Serial.print("to station ok\r\n");     } else {         Serial.print("to station err\r\n");     }     if (wifi.joinAP(SSID, PASSWORD)) {         Serial.print("Join AP success\r\n");         Serial.print("IP: ");               Serial.println(wifi.getLocalIP().c_str());         IP = wifi.getLocalIP().c_str();         lcd.setCursor(0, 1);         lcd.print("Join AP success");         lcd.setCursor(0, 2);         lcd.print("IP: "+IP);     } else {         Serial.print("Join AP failure\r\n");         lcd.setCursor(0, 1);         lcd.print("Join AP failure");         lcd.setCursor(0, 2);         lcd.print("Contact Administrator");     }      if (wifi.enableMUX()) {         Serial.print("multiple ok\r\n");     } else {         Serial.print("multiple err\r\n");     }     if (wifi.startTCPServer(80)) {         Serial.print("start tcp server ok\r\n");         lcd.setCursor(0, 3);         lcd.print("Server Ready");     } else {         Serial.print("start tcp server err\r\n");         lcd.setCursor(0, 3);         lcd.print("Server Setup Fail");     }     if (wifi.setTCPServerTimeout(10)) {         Serial.print("set tcp server timout 10 seconds\r\n");     } else {         Serial.print("set tcp server timout err\r\n");     }           Serial.print("setup end\r\n"); } void loop() {    uint8_t buffer[128] = {0};     uint8_t mux_id;     uint32_t len = wifi.recv(&mux_id, buffer, sizeof(buffer), 100);     if (len > 0) {         Serial.print("Status:[");         Serial.print(wifi.getIPStatus().c_str());         Serial.println("]");                 Serial.print("Received from :");         Serial.print(mux_id);         Serial.print("[");         for(uint32_t i = 0; i             Serial.print((char)buffer[i]);             msg = "";             msg += ((char)buffer[i]);                         if (msg == "p")             {               count=1;                                         }                          if (msg != "p" & count ==1)             {               if(msg =="i")               {                                 count++;               }               else               {                                 count = 0;               }             }             if (msg !="i" & count ==2)             {               if (msg =="n")               {                 count++;               }               else               {                 count = 0;               }             }             if (msg !="n" & count ==3)             {               if(msg=="=")               {                 count++;                               }               else               {                 count = 0;               }             }             if (msg != "=" & count==4)             {               Serial.print(msg);               pinnum =msg;               count = 0;             }                     }         Serial.print(pinnum);         Serial.print("]\r\n");         int pin = pinnum.toInt();         Serial.print(pin);         digitalWrite(pin, !digitalRead(pin)); // toggle pin            String content;      content = "چراغ ";      content += pinnum;      content += " is ";           if(digitalRead(pin))      {        content += "ON";      }      else      {        content += "OFF";      }                 if(wifi.send(mux_id, buffer, len)) {             Serial.print("send back ok\r\n");         } else {             Serial.print("send back err\r\n");         }                 if (wifi.releaseTCP(mux_id)) {             Serial.print("release tcp ");             Serial.print(mux_id);             Serial.println(" ok");         } else {             Serial.print("release tcp");             Serial.print(mux_id);             Serial.println(" err");         }                 Serial.print("Status:[");         Serial.print(wifi.getIPStatus().c_str());         Serial.println("]");     }   }

Asked by Arsalan Ahmadi 2 years ago