the chances of AI finding well written pbp code to plagiarize from are slim at best.AI, simulation, virtualization.... What happened to the good old breadboard?
afaics AI can only write code if it can plagiarize it from somewhere, the code only works if the stolen code exactly matched your circumstances.
its quite amazing that this plagiarism is tolerated just because a machine is stealing it. open source etc. does not mean you can copy it and pass it off as your own original work.
breadboard , the manual and a data sheet is at least an honest and rewarding learning experience
henriks work as it needs to be
Code:#CONFIG cfg = _INTRC_OSC_NOCLKOUT cfg&= _WDT_ON cfg&= _PWRTE_OFF cfg&= _MCLRE_ON cfg&= _BODEN_ON cfg&= _CP_OFF cfg&= _CPD_OFF __CONFIG cfg #ENDCONFIG CMCON = 7 TRISIO = 111001 INTCON = $C0 PIE1.0 = 1 ANSEL = 110001 ADCON0 = 000001 Long_Press CON 5000 Short_Press con 100 cnt VAR WORD b_level VAR BYTE but VAR BYTE DataW VAR WORD Main: GOSUB ReadButton IF but > 0 THEN cnt = 0 WHILE but > 0 cnt = cnt + 10 if cnt > Long_Press THEN EXIT PAUSE 10 GOSUB ReadButton WEND SEROUT GPIO.2, 2, ["You pressed button ", #b_level, " for ", #cnt, "ms", 13, 10] endif Goto Main ReadButton: ADCON0.1 = 1 While ADCON0.1 = 1 : Wend DataW.HighByte = ADRESH DataW.LowByte = ADRESL but = 0 if DataW < 805 then but=1 if DataW > 50 AND DataW < 160 THEN b_level = 1 if DataW > 180 AND DataW < 270 THEN b_level = 2 if DataW > 290 AND DataW < 380 THEN b_level = 3 if DataW > 400 AND DataW < 520 THEN b_level = 4 if DataW > 540 AND DataW < 650 THEN b_level = 5 if DataW > 690 AND DataW < 800 THEN b_level = 6 ENDIF RETURN




Bookmarks