Bascomowców

formatting link
Za Basicem nie przepadam. Specjalnie dla Tibbo trochę musiałem grzebnąć w tym języku. Za to Bascomowcom przesiadkę na 32 bity pewnie ułatwi, szczególnie że już wspiera popularne i tanie u nas układy STM32. Przykład chyba dobrze wygląda, a zapis typu @nazwa nie odstraszy aż tak bardzo...

' Project name: ' Button_Test (Sample usage of Button() function) [...]

program Button_Test dim oldstate as byte main: GPIO_Digital_Input(@GPIOA_BASE, _GPIO_PINMASK_0) ' Set PA0 as digital input GPIO_Digital_Output(@GPIOD_BASE, _GPIO_PINMASK_ALL) ' Set PORTD as digital output oldstate = 0

while TRUE if (Button(GPIOA_IDR, 0, 1, 1) <> 0) then ' detect logical one on PA0 pin oldstate = 1 ' update flag end if if (oldstate and Button(GPIOA_IDR, 0, 1, 0)) then ' detect one-to-zero transition on PA0 pin GPIOD_ODR = not GPIOD_ODR ' invert PORTD value oldstate = 0 ' update flag end if wend ' endless loop end.

Reply to
Michał Lankosz
Loading thread data ...

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.