Für dieses Forum muß Javascript im Browser aktiviert werden!
Kommentar: Einfügen von HTML im Kommentar: Link einfügen: <a href="LINKURL" target="_blank">LINKTITEL</a> Bild einfügen: <img src="BILDURL"> Text formatieren: <b>fetter Text</b> <i>kursiver Text</i> <u>unterstrichener Text</u> Kombinationen sind auch möglich z.B.: <b><i>fetter & kursiver Text</i></b> C2 Quellcode formatieren: <code>Quellcode</code> ASM Quellcode formatieren: <asm>Quellcode</asm> (Innerhalb eines Quellcodeabschnitts ist kein html möglich.) Wichtig: Bitte mache Zeilenumbrüche, bevor Du am rechten Rand des Eingabefeldes ankommst ! > Hallo, kann mir vielleicht einer sagen, ob man so die if-Abfragen > gestalten kann? > > <code> > thread main > { > stports.init(); > lcdext.init(); > lcdext.print(" C-CONTROL II"); > lcdext.line(2); > lcdext.print("hw-com"); > > byte i; > int ad[6]; > > sleep 25; > hwcom.setspeed(3); // Bitrate einstellen 3:2400 5:9600 > > for i = 0 ... 5 // Schleife für Port 0 bis 5 > { > ad[i] = ports.adc(i); > hwcom.num(ports.adc(i)); //aktuellen Wert des Ports senden > sleep 25; // kurze Pause > hwcom.tab(); // Tabulatur senden > sleep 25; // kurze Pause > } > hwcom.ret(); // Zeilenumbruch senden > sleep 25; // kurze Pause > > if > ( > (ad[0]>=446 and ad[0]<= 502) and //blau-Abfrage > (ad[1]>=504 and ad[1]<= 560) and > (ad[2]>=537 and ad[2]<= 562) and > (ad[5]>=394 and ad[3]<= 418) and > (ad[4]>=445 and ad[4]<= 465) and > (ad[3]>=449 and ad[5]<= 482) > ) > lcdext.print("blau"); > else > if( > (ad[0]>=512 and ad[0]<= 566) and //braun-Abfrage > (ad[1]>=577 and ad[1]<= 611) and > (ad[2]>=596 and ad[2]<= 655) and > (ad[5]>=460 and ad[3]<= 519) and > (ad[4]>=462 and ad[4]<= 539) and > (ad[3]>=455 and ad[5]<= 540) > ) > lcdext.print("braun"); > else > if( > (ad[0]>=419 and ad[0]<= 442) and //gelb-Abfrage > (ad[1]>=484 and ad[1]<= 509) and > (ad[2]>=493 and ad[2]<= 527) and > (ad[5]>=334 and ad[3]<= 370) and > (ad[4]>=391 and ad[4]<= 450) and > (ad[3]>=408 and ad[5]<= 464) > ) > lcdext.print("gelb"); > else > if( > (ad[0]>=464 and ad[0]<= 515) and //grün-Abfrage > (ad[1]>=519 and ad[1]<= 561) and > (ad[2]>=556 and ad[2]<= 583) and > (ad[5]>=422 and ad[3]<= 456) and > (ad[4]>=470 and ad[4]<= 512) and > (ad[3]>=474 and ad[5]<= 492) > ) > lcdext.print("grün"); > else > if( > (ad[0]>=491 and ad[0]<= 527) and //lila-Abfrage > (ad[1]>=545 and ad[1]<= 592) and > (ad[2]>=563 and ad[2]<= 611) and > (ad[5]>=443 and ad[3]<= 504) and > (ad[4]>=449 and ad[4]<= 526) and > (ad[3]>=450 and ad[5]<= 522) > ) > lcdext.print("lila"); > else > if( > (ad[0]>=436 and ad[0]<= 481) and //orange-Abfrage > (ad[1]>=509 and ad[1]<= 539) and > (ad[2]>=509 and ad[2]<= 548) and > (ad[5]>=367 and ad[3]<= 389) and > (ad[4]>=405 and ad[4]<= 431) and > (ad[3]>=440 and ad[5]<= 477) > ) > lcdext.print("orange"); > else > if( > (ad[0]>=448 and ad[0]<= 478) and //pink-Abfrage > (ad[1]>=509 and ad[1]<= 542) and > (ad[2]>=517 and ad[2]<= 540) and > (ad[5]>=378 and ad[3]<= 411) and > (ad[4]>=409 and ad[4]<= 449) and > (ad[3]>=430 and ad[5]<= 490) > ) > lcdext.print("pink"); > else > if( > (ad[0]>=444 and ad[0]<= 484) and //rot-Abfrage > (ad[1]>=516 and ad[1]<= 551) and > (ad[2]>=525 and ad[2]<= 443) and > (ad[5]>=411 and ad[3]<= 430) and > (ad[4]>=437 and ad[4]<= 463) and > (ad[3]>=475 and ad[5]<= 503) > ) > lcdext.print("rot"); > else > lcdext.print("unbekannt"); > > } > </code>