How to make code open source

I have been working on some code for practically years giving my self breaks for a few months at a time

i have finally completed it..Seems to work perfectly for ANY AVR ..What i had in mind was to make an

attiny with > 2K solar tracker ..I have a prototype built on a breadboard works as ..I was hoping for ..

kind of simple code ..I do not want to go through the trouble of making my own blog or making an

instructable.. Is there anywhere to post code for anyone to use ?

Many people use Github. It is free for noncommercial users and open source projects.

OK do I have to make an account ?

Here is the Program BTW

 * -----------------------------------------------------WORKS-WELL-FOR-ATTINY85--------------------
 * ------------------------------------------------------use-ATtiny25/45/85------------------------
 *------------------------------------------ NEEDs--Hbridge--to-control--linear-actuator-----------
 * -------Arduino-is-the-outter-most-pins------
 *----------- ATtiny13/25/45/85-pinout---------
 * ------------RESET--OO     O-------VCC-------
 * --LDR--3----A3/PB3-O      O--PB2/-SCK/A1---2--LDR
 * -------4----A2/PB4-O      O--PB1/-MISO-----1--OUT
 * -------------GND---O      O--AREF/MOSI-----0--OUT
 * ---For-AREF-use-LM336Z-5.0--pretty-accurate!
#define L1 0 //2 on UNO
#define L2 1 //3 on UNO

float V1;//LDR is on A1 on pin 7
float V2;//LDR is on A3 on pin 3
float VT = .020;// more millivolts means bigger bandgap (Less Precise) 

void setup() 

pinMode(L1,OUTPUT);//was 0 on attiny85
pinMode(L2,OUTPUT);//was 1 on attiny85
void loop() 
V1 = analogRead(A1);  //LDR1 is below vcc on attiny85
V2 = analogRead(A3);  //LDR2 is below reset attiny85
V1=V1 * (5.0 / 1023.0);// 
V2=V2 * (5.0 / 1023.0);//

abs(V2);//make absolute so there is no negitave numbers
abs(V1);//make absolute so there is no negitave numbers

float voltage;
if(V1 > V2){voltage = V1 - V2;}//teset to see which is higher and set voltage to higher number  
if(V2 > V1){voltage = V2 - V1;}//teset to see which is higher and set voltage to higher number  

if(V1 > (V2+VT)){digitalWrite(L1,HIGH);digitalWrite(L2,LOW);} //Serial.println("LEFT");}// add VT to make it not so sensitive

if(V2 > (V1+VT)){digitalWrite(L1,LOW);digitalWrite(L2,HIGH);}// Serial.println("RIGHT");}// add VT to make it not so sensitive

if(voltage <= VT){digitalWrite(L1,LOW);digitalWrite(L2,LOW);}// Serial.println("STOP");}// add VT to make it not so sensitive

//remove C style comments to use with arduino serial monitor 
Serial.print("Voltage ");Serial.println(voltage);
Serial.print("V1 ");Serial.println(V1);
Serial.print("V2 ");Serial.println(V2);

abs returns the absolute value.

and use autoformat

i dont use auto format and i know what abs() is used for .....

This statement does absolutely nothing:

abs(V2);//make absolute so there is no negitave numbers

so, no, you don't know what abs() is used for.


If you have a few photos / info about the project I would also host it on http://ArduinoInfo.Info

Email me. I can do most formatting etc…

Regards, Terry King
…In The Woods in Vermont, USA

OK i can remove abs() and I don,t have digital a camera ..any way where would be a good place to post this ?

Put it on Github. You do need to sign up for an account (you'd have to do this for any method of sharing your code, since you need to be able to get in later to update it). Github has a lot of features that are great for open source projects, and it's become the de facto standard for this sort of thing. If you don't have a github account yet, you'll want/need one sooner or later if you keep doing software related stuff.

i dont use auto format

Indentation makes code much easier to read. If you don't like what Tools > Auto Format does you should at least manually indent your code.

Keep in mind that code is not truly open source unless it's accompanied by an appropriate license. Without a license anything you publish is "all rights reserved" which means nobody can use it without violating your copyright.

yea good advice guys ill autoindent then post on github

This line needs to changed to this

if(voltage >= VT){digitalWrite(L1,LOW);digitalWrite(L2,LOW);}

otherwise you will detect in wrong direction

You could also post on the playground section of this web site.