Switching/Controller Project - To DIY Or Not

I've been thinking about it, and last night I played around with some PICAXE code on an emulator and was able to get it to do things fairly easily. That's mostly what led me to try it on my own. Of course, that was just the simple stuff, no PWM or communication involved - that's what I'll have the most difficult time with.

The code I wrote last night is below. If I spent more time on it I'm sure I could have made ot more streamlined. I'm pretty sure coding for the Arduino would be similar for the same functions. Wish me luck!


#picaxe 40X2
eeprom 0,(0)
main:
	'Begin channel selection, only 1 of 8 on at a time
	if pinA.0=0 AND pinA.1=0 AND pinA.2=0 then
	{
		high C.0 low C.1 low C.2 low C.3 low C.4 low C.5 low C.6 low C.7
	}
	endif
	if pinA.0=1 AND pinA.1=0 AND pinA.2=0 then
	{
		low C.0 high C.1 low C.2 low C.3 low C.4 low C.5 low C.6 low C.7
	}
	endif
	if pinA.0=0 AND pinA.1=1 AND pinA.2=0 then
	{
		low C.0 low C.1 high C.2 low C.3 low C.4 low C.5 low C.6 low C.7
	}
	endif
	if pinA.0=1 AND pinA.1=1 AND pinA.2=0 then
	{
		low C.0 low C.1 low C.2 high C.3 low C.4 low C.5 low C.6 low C.7
	}
	endif
	if pinA.0=0 AND pinA.1=0 AND pinA.2=1 then
	{
		low C.0 low C.1 low C.2 low C.3 high C.4 low C.5 low C.6 low C.7
	}
	endif
	if pinA.0=1 AND pinA.1=0 AND pinA.2=1 then
	{
		low C.0 low C.1 low C.2 low C.3 low C.4 high C.5 low C.6 low C.7
	}
	endif
	if pinA.0=0 AND pinA.1=1 AND pinA.2=1 then
	{
		low C.0 low C.1 low C.2 low C.3 low C.4 low C.5 high C.6 low C.7
	}
	endif
	if pinA.0=1 AND pinA.1=1 AND pinA.2=1 then
	{
		low C.0 low C.1 low C.2 low C.3 low C.4 low C.5 low C.6 high C.7
	}
	endif
	'End channel selection
	'Begin effect settings, no restrictions 
	if pinA.3=1 then high D.0 endif
	if pinA.3=0 then low D.0 endif
	if pinA.5=1 then high D.1 endif
	if pinA.5=0 then low D.1 endif
	'End effect settings
	'Begin tap tempo
	if pinA.6=1 then high D.2 endif
	if pinA.6=0 then low D.2 endif
	'End tap tempo
	'Begin mute
	if pinA.7=1 then high D.3 endif
	if pinA.7=0 then low D.3 endif
	'End mute
	'Begin chorus toggle
	if pinB.0=1 then high D.4 endif
	if pinB.0=0 then low D.4 endif
	'End chorus toggle
	'Begin delay toggle
	if pinB.1=1 then high D.5 endif
	if pinB.1=0 then low D.5 endif
	'End delay toggle
	'Begin delay options
	if pinD.6=1 then
	{
		read b0,b1
		if b1<3 then inc b1 elseif b1=3 then b1=0 endif
	}
	endif
	write b0,b1
	read b0,b1
	if b1=0 then low B.2 low B.3 low B.4 endif
	if b1=1 then high B.2 low B.3 low B.4 endif
	if b1=2 then low B.2 high B.3 low B.4 endif
	if b1=3 then low B.2 low B.3 high B.4 endif
goto main