Click here to Skip to main content
15,890,123 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: InitDialog in splitter Pin
Victor Nijegorodov30-Mar-16 5:09
Victor Nijegorodov30-Mar-16 5:09 
SuggestionRe: InitDialog in splitter Pin
David Crow29-Mar-16 9:11
David Crow29-Mar-16 9:11 
Questionarduino sensor Pin
Member 1240312128-Mar-16 7:35
Member 1240312128-Mar-16 7:35 
AnswerRe: arduino sensor Pin
David Crow28-Mar-16 9:40
David Crow28-Mar-16 9:40 
AnswerRe: arduino sensor Pin
Richard MacCutchan28-Mar-16 21:44
mveRichard MacCutchan28-Mar-16 21:44 
GeneralRe: arduino sensor Pin
Sascha Lefèvre28-Mar-16 23:31
professionalSascha Lefèvre28-Mar-16 23:31 
GeneralRe: arduino sensor Pin
Member 1240312130-Mar-16 23:19
Member 1240312130-Mar-16 23:19 
GeneralRe: arduino sensor Pin
leon de boer3-Apr-16 6:43
leon de boer3-Apr-16 6:43 
The only thing I can see change between the two modes is the delay

C++
// COMBINED MODE 1 & 2 CODE FROM WHAT YOU GAVE

int led = 13;
int mode = 1;                     //  Set mode 1 start                  
static int delay1[2] = {500, 0};  // 500ms delay for mode 1, 0 ms delay for mode 2
static int delay2[2] = {500, 5000};  // 500ms delay for mode 1, 5000 ms delay for mode 2

void setup() {
pinMode(led, OUTPUT);
}

void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(delay1[mode-1]);   // wait depending on mode .. dont forget arrays start at zero in c
digitalWrite(led, LOW);  // turn the LED off by making the voltage LOW
delay(delay2[mode-1]);   // wait depending on mode .. dont forget arrays start at zero in c

// this is just to show off both modes usually something does this change  
// this code simple forces alternation between the 2 modes
if (mode == 1) mode = 2; else mode = 1;
}

In vino veritas

QuestionCOleDateTime Pin
Still learning how to code27-Mar-16 9:48
Still learning how to code27-Mar-16 9:48 
AnswerRe: COleDateTime Pin
Serkan Onat27-Mar-16 12:44
professionalSerkan Onat27-Mar-16 12:44 
GeneralRe: COleDateTime Pin
Still learning how to code27-Mar-16 22:11
Still learning how to code27-Mar-16 22:11 
GeneralRe: COleDateTime Pin
Jochen Arndt28-Mar-16 1:50
professionalJochen Arndt28-Mar-16 1:50 
GeneralRe: COleDateTime Pin
Still learning how to code28-Mar-16 22:58
Still learning how to code28-Mar-16 22:58 
GeneralRe: COleDateTime Pin
Jochen Arndt28-Mar-16 23:08
professionalJochen Arndt28-Mar-16 23:08 
QuestionOld code Pin
RomTibi27-Mar-16 9:18
RomTibi27-Mar-16 9:18 
AnswerRe: Old code Pin
Patrice T27-Mar-16 10:46
mvePatrice T27-Mar-16 10:46 
AnswerRe: Old code Pin
Sascha Lefèvre27-Mar-16 12:38
professionalSascha Lefèvre27-Mar-16 12:38 
AnswerRe: Old code Pin
David Crow28-Mar-16 3:55
David Crow28-Mar-16 3:55 
SuggestionRe: Old code Pin
Richard MacCutchan28-Mar-16 6:08
mveRichard MacCutchan28-Mar-16 6:08 
AnswerRe: Old code Pin
Richard MacCutchan28-Mar-16 6:03
mveRichard MacCutchan28-Mar-16 6:03 
QuestionAlgorithm on secrete key generation Pin
Durga Prasad Chauhan25-Mar-16 23:32
Durga Prasad Chauhan25-Mar-16 23:32 
AnswerRe: Algorithm on secrete key generation Pin
Richard MacCutchan26-Mar-16 1:32
mveRichard MacCutchan26-Mar-16 1:32 
AnswerRe: Algorithm on secrete key generation Pin
Patrice T27-Mar-16 10:31
mvePatrice T27-Mar-16 10:31 
Questionvector in turbo c Pin
Ravinder Singh25-Mar-16 20:50
Ravinder Singh25-Mar-16 20:50 
AnswerRe: vector in turbo c Pin
Richard MacCutchan25-Mar-16 22:46
mveRichard MacCutchan25-Mar-16 22:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.