Conductive fur project

Hi everyone, i think I am posting in the appropriate section but sorry if it isnt.
For uni I am making a light switch which is controlled by 4 rows of exposed wires (A, B, C, D) acting as capacitive sensors poking up through fake fur. the whole class is based on haptics (touch). i have managed to program it so that when you touch an exposed wire from row A it makes an led light turn onto a low brightness and as you touch the others from left to right the light becomes brighter. Also in order to turn it off you go back over the exposed wires from right to left, the code for this is capacitivesensor beta6. However, I now would love to be able to code it so that after you have continually stroking it from left to right for 5 seconds or more the light starts to flicker like a purring cat as well. I have tried to code it to do this but with the code i have done it only seems to make the light start flickering 1 second after you have patted it or after only giving it one stroke. the code for this is capacitivesensorbeta9. if anyone could provide some help with coding it so that it does what I have said I want it to do then it would be greatly appreciated!!!

CapacitiveSensorBeta6.ino (4.06 KB)

CapacitiveSensorBeta9.ino (4.82 KB)

Could someone please reply! I will be forever greatful!

vco16: Could someone please reply! I will be forever greatful!

You have done several things wrong with this post. First it is in the wrong section. In what way is this "not to do with your project" as stated in the section's description.

Second the code is posted incorrectly.

Third you have not read the how to use this forum sticky post.

as stated in the post I am sorry if it is in the wrong forum and I realise it now is. however, I do not see how my code is posted incorrectly as it was too long to include in the post. also i did read that sticky post.

vco16: I do not see how my code is posted incorrectly as it was too long to include in the post. also i did read that sticky post.

You did not read the sticky correctly because that told you about 1) using code tags to post your code - you have not 2) posting long code as an attachment using the additional options triangle at the bottom right of the reply box. 3) you can modify your posts by clicking the oddly descriptive "modify" link above your post.

ok so i have now attached the arduino files to the post

not sure what else i can do. i cant make anyone on this forum help me out with my problem, but what i can do is put myself out there and offer my gratitude and love. and from where i come that is worth something.

Thank you for your changes. Although you could make it easy for people by including the whole folder with the .ino file.

i cant make anyone on this forum help me out with my problem,

Note from here http://forum.arduino.cc/index.php/topic,148850.0.html:-

Note that generally questions posted on the forum are answered within the hour, by someone or other. Asking a particular person to help may cause at least an 8-hour delay, if they happen to be asleep, at work, out fishing or whatever they are doing.

I have spent some time looking at your code, it is difficult to follow because of lack of comments. However this part struck me as wrong:-

int comparetrigtime = 0;
 comparetrigtime = trigTimeA - trigTimeC;

You are trying to store the result of subtraction of two longs into an int. I would try that as a long also.

The bit where you define the pattern time out is also in ints. I think anything to do with the millis timer should be defined as long.

As you have the hardware and the rest of us do not then we can't fix it for you. However I would suggest that you put some debug statements in to print out where you entered bits of code and what the values of variables are at that point.

So print out when you mark the time that you want to measure the pattern time out from. Also print out the values when you enter the pattern time out code so you can see if they are what you expect them to be.

If you are puzzled by the results then post what they are and ask about them.

thanks for the reply. i will try that out.

please do not use this forum to ask for final debugging of academic projects which you'll get marked on.

ad2049q:
please do not use this forum to ask for final debugging of academic projects which you’ll get marked on.

I am a former academic and I do not consider he is asking anything improper. If he were wanting finished code that is another matter but asking for help, which he got, and is happy to act on that. I have no trouble with this, it is part of the learning process.

If he were to have responded with “can you make these changes for me” that would have been another matter.