Here I put my code that I assembly by myself looking at the existing program on many website.And I put it into simulation and it works as I expected.I would like to developed more complex circuit but I can not find the way, because in my programming I use too many void and it has no return value.So when it comes to more complicated circuit, the programming is like a mess.One way I can solve this by use "return", it is just like we go to certain subroutine and after it finish, it will be back to the place which command it to go.

Do you know how I can use "return", surely without void.It will help me so much to have more structured programming.I hope you do not suggest me to learn C++ from "Hello World", I hope you can tell me how to make it in the IDE.Thank you friends!

// Simple function to send serial data to one or more shift registers by iterating backwards through an array.// Although g_registers exists, they may not all be being used, hence the input parameter.void sendSerialData ( byte registerCount, // How many shift registers? byte *pValueArray) // Array of bytes with LSByte in array [0]{ // Signal to the 595s to listen for data digitalWrite (g_pinCommLatch, LOW);

Int myFunction (any arguments){ if (condition is true) { return 1; // or any other value you want } else { return 2; // or any other value you want }}

So if the condition is true you get a 1 returned to the calling Sketch otherwise you get a 2. You may y return as many values as you need by using several return statements or just one return using a variable with the right value.

Billy http://www.z-world.com/operations/gbremer/

When you've eliminated the impossible, whatever remains, however improbable, must be

setup can be at the start, the IDE generates the function prototypes at the top of the file when you compile.

in a function paramater list:

& means pass by reference, rather than by value. ( if the function modifies the variable, it modifies the original passed variable, not a copy )

* means the variable is actually a pointer. ( address to variable ), the * in the code has different meanings, it converts/dereferences the address to the variable ( original passed variable )

when the function is called 'AddNumbers( a, b, &result );' the & operator gets the address of result ( pointer ), the compiler will call 'void AddNumbers( int a, int b, int *result )' as the result paramater is a pointer

Each version produces the same result, just different ways of doing it.

But like I asked, what do you want to return, an unused return value is a waste. The function modifies data that you can already access, if you can check that the send happened correctly, you could return like my example above. A void function ( method ) is fine.

The type before the name of your function is what it returns. "void" means "no type," so saying "void loop()" means "I'm defining a function which takes no arguments and returns nothing" and "char read()" means "I'm defining a function which takes no arguments and returns a char" and "bool isWithinRange(int x)" means "I'm defining a function which takes an integer and returns a bool"

So to make your function return something, change the void to bool. Then, in the body of the function, you have to honor your promise and actually return something. (Say: "return var;" assuming var is an int. You could also say "return 42;" if you wanted to return a constant.)