new project need help
science_geek
Posts: 247
im am going to get the piezo film tabs from the parallax website in a few days and i need help with some minor coding, i want to make a guitar so that when i hit the tab and a switch a certain frequency plays, but i want the switches to be worth a·certain value like switch one = 200 and the 200 would be added to the frequency of the tab that is hit, a sample code could be
'IN1 = PIEZO TAB
'IN4 = FREQUENCY ADDER
ADDER····· PIN···· 4
ADDER1 = 200
IF IN1 = 1 AND ADDER = 1 THEN
FREQOUT 15, 10, (1000 + ADDER1)
dont think you guys will quite understand this, but i know somebody out there speaks my language
'IN1 = PIEZO TAB
'IN4 = FREQUENCY ADDER
ADDER····· PIN···· 4
ADDER1 = 200
IF IN1 = 1 AND ADDER = 1 THEN
FREQOUT 15, 10, (1000 + ADDER1)
dont think you guys will quite understand this, but i know somebody out there speaks my language
Comments
Something like, if, say, tab 1 is worth 200, tab 2 is worth 400 and tab 3 is worth 800, so the output is 1200 if 2 and 3 are pressed at the same time, and 600 if 1 and 2 are pressed at the same time?
Regards
Duncan
switches VAR NIB
switches=INA
SELECT switches
CASE 1
frequency 1
CASE 2
frequency 2
etc.
Jeff T.
Consider placing the tabs on adjacent I/O pins, and reading them all together.
If the frequencies are multiples (200/400/800/1600/3200) take the value that you read from the port, and just multiply it with the lowest frequency. (If you have a 'base frequency' of say 1000, just add it afterwards)
If they're NOT multiples, write a table with every combination, and use the value read from the port as a pointer...
(takes a bit of space, but is much faster and 'cleaner' code. Also, and 'base frequency' can be incorporated to the table. )
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't visit my new website...