Go to advanced search

by girl71
Mon Dec 07, 2015 9:47 am
Forum: C/C++
Topic: How can store size of vector first then do Condition??
Replies: 1
Views: 488

How can store size of vector first then do Condition??

I cast int value in vector then for `vector.size()` condition ,do something my condition is if(values.size()==1) in first time always vector.size() is 1,how can wait to get all int value and doesn't //dosomething of this condition quickly after get first int,need an other condition?? vector<int> val...
by girl71
Sun Nov 08, 2015 8:53 am
Forum: C/C++
Topic: how can get howlong key hold??
Replies: 9
Views: 1428

Re: how can get howlong key hold??

I'm confused :shock: :shock: wooow really i need you'r forgive :| :| :|
by girl71
Sun Nov 08, 2015 8:42 am
Forum: C/C++
Topic: how can get howlong key hold??
Replies: 9
Views: 1428

Re: how can get howlong key hold??

GetKeyState() is in windows.h header??isn't??
by girl71
Sun Nov 08, 2015 8:36 am
Forum: C/C++
Topic: how can get howlong key hold??
Replies: 9
Views: 1428

Re: how can get howlong key hold??

what??
by girl71
Sun Nov 08, 2015 8:30 am
Forum: C/C++
Topic: how can get howlong key hold??
Replies: 9
Views: 1428

Re: how can get howlong key hold??

hi,thank you
but my OS is linux :cry:
by girl71
Sun Nov 08, 2015 6:13 am
Forum: C/C++
Topic: how can get howlong key hold??
Replies: 9
Views: 1428

how can get howlong key hold??

I want to get how long key down, wiringPi has function millis(); with this function can get how long any key hold??

Code: Select all

key=getch();
keyholdTime=millis();
if(millis()<1000){

//do some thing
}
else {
 // do some thing
}
by girl71
Tue Nov 03, 2015 7:26 pm
Forum: C/C++
Topic: How set certain time for digitalwrite
Replies: 11
Views: 1585

Re: How set certain time for digitalwrite

@ davenull thank you
by girl71
Tue Nov 03, 2015 7:16 pm
Forum: C/C++
Topic: How set certain time for digitalwrite
Replies: 11
Views: 1585

Re: How set certain time for digitalwrite

You need all the code (apart from main) to put the system into non-blocking I/O. You can't pick and choose which parts might look relevant. In your main you need to make the calls to set_conio_terminal_mode() at the start, reset_terminal_mode() at the end, and check dataRdy(0) before the getch(). t...
by girl71
Tue Nov 03, 2015 10:01 am
Forum: C/C++
Topic: How set certain time for digitalwrite
Replies: 11
Views: 1585

Re: How set certain time for digitalwrite

oops it's better
by girl71
Tue Nov 03, 2015 5:59 am
Forum: C/C++
Topic: How set certain time for digitalwrite
Replies: 11
Views: 1585

Re: How set certain time for digitalwrite

Thank you but,If I use part of your code, for stop program still need press key....... int digital:: getch() { int r; unsigned char c; if ((r = read(0, &c, sizeof(c))) < 0) { return r; } else { return c; } } void digital::loop(int motor_pin_1, int motor_pin_2, char key) { unsigned long startTime; pr...
by girl71
Mon Nov 02, 2015 7:38 pm
Forum: C/C++
Topic: How set certain time for digitalwrite
Replies: 11
Views: 1585

Re: How set certain time for digitalwrite

your mean change 'd' to '100' of ascii value??If i change it the problem still exist :? :?
by girl71
Mon Nov 02, 2015 5:10 pm
Forum: C/C++
Topic: How set certain time for digitalwrite
Replies: 11
Views: 1585

Re: How set certain time for digitalwrite

scanf, is the same does??
by girl71
Mon Nov 02, 2015 4:48 am
Forum: C/C++
Topic: How set certain time for digitalwrite
Replies: 11
Views: 1585

How set certain time for digitalwrite

I'm new in programming with wiring pi :oops: :oops: and I want to set time for digital write with get time(NULL) after get key then stop writing (after certain time or with e key)and goto first of loop , my program doesn't work ,what is the problem?? :roll: :roll: I try with millis() but after 5sec ...

Go to advanced search