FSR - Conductive foam readings

Hello! I am making a prototype of a force sensitive resistor, and i am using, to old 97%kobber coins, metal sheet and a tiny piece of conductive foam that i got from a tv-repair shop. The setup is not very good, but its a start, and i am planning the next move for better results... Now... I want some decent understanding of how the readings work, and why I get these results.. First test, are written with black, and and as you can see it, has the same amount of space between 0-1kg and 1-2kg, but 2-3 and 3-4 changes to a very small space? Why is that? Second question is, that i have used the x10, to read larger forces. 0-2,5kg and 2,5-5kg has same amount of space. Will the space decrease too, when getting further up the scale too?  - I know the conductive foam has its limits too, but just to be clear of my readings. Thanks in advance! I hope you can see the readings on the picture..!

Topic by L33boy 4 years ago  |  last reply 4 years ago


Force sensitive resistor plus LED plus battery. Will pressure on the FSR be able fade the LED brightness in and out?

I am trying to achieve a handheld firefly effect by using an LED that is controlled by the FSR in order to get the "firefly" light to fade in and out. Can someone give me an idea of how to set this up? Thanks!

Question by ryanswiftjoyner 7 years ago  |  last reply 7 years ago


how do you measure the weight of pushing on every pedal of a bicycle?

It's for a school project.. I thought the FSR sensor and arduino. I would like to measure the weight of a person for example 100kg.Maximum value of the FSR sensor is 10kg. I would like something more in detail if you could help me.

Question by CristiZ 1 year ago


how to measure the weight of pushing on every pedal of a bicycle?

It's for a school project.. I thought the FSR sensor and arduino. I would like to measure the weight of a person for example 100kg.Maximum value of the FSR sensor is 10kg. I would like something more in detail if you could help me.

Question by CristiZ 1 year ago  |  last reply 1 year ago


Does anyone know how i can connect a FSR force sensor to a digital alarm clock ?

I would like to trigger the alarm when it is under 80 ohm (Maybe).  about the FSR force sensor -- > http://www.ladyada.net/learn/sensors/fsr.html

Question by aliibaba 8 years ago  |  last reply 8 years ago


Arduino Game Coding - FSR (Pressure Sensor) Based Shooting Game

I'm making a shooting style arcade game in which you shoot a projectile at four different force sensitive resistors trying to rack up as many points as possible before the timer runs out. When a ball hits one of the fsr I want to have the arduino keep score and show it on a 16x2 lcd. Each one of the fsr have a different point value.              Ex:  A ball hits fsr _1 giving the player 5pts, another hits fsr_3 giving the player another 15pts. The 60 second timer then runs out and  the game shows you your score on the lcd... 20pts. I've been trying to wrap my head around how to code something like this but I am just making myself more confused. Any help would be appreciated! Thanks!

Question by rixter1818 2 years ago  |  last reply 2 years ago


does anyone know how i can connect a FSR force sensor to a digital alarm clock ?

So it can trigger at 80 ohm, 

Question by aliibaba 8 years ago  |  last reply 8 years ago


Anyone Have experience with Adafruit Square FSR?

I am hoping to create a circuit that will variably control the speed of a motor through pressure. If I were to wire up one of these http://www.adafruit.com/products/1075 , simply as the switch between a small motor and a power source around 5v, would it work to simply turn the motor off at rest and vary the speed with pressure? Is there a way to use this resistor as a "switch" without using an Arduino or  other micro controller? Any help is appreciated. Thanks! 

Topic by Flashflint 4 years ago  |  last reply 4 years ago



Is there a way to change the value of a variable and keep it afterwards? Arduino Answered

Hello everyone, I don't really know if this is possible, I am using processing, arduino and a force sensitive resistor to control a servo and I want to change the value of a variable and then if I reset the arduino, it will kept the new value. Is there anyway to do this? This is the part of my code I want to change. void fsrMovement(){         int maxforce= 1023;  // THIS IS THE VARIABLE         if(Serial.available()){  // SERIAL AVAILABLE TO USE WITH PROCESSING         maxforce = Serial.read();         }         force = analogRead(FSR);  // Reads the FSR               Serial.print("Force sensor reading = ");         Serial.println(force); // This will print the raw force value         int pos = map(force, 0, maxforce, 0, 175); // Scales the force reading to degrees for servo control         Serial.print("servomotor degrees = ");         Serial.println(pos); // This will print the adjusted servo reading (an angle)         myservo1.write(pos); // Write the new angle to the servo         delay(10); // Delay 10 milliseconds before taking another reading

Question by rojascan 2 years ago  |  last reply 2 years ago


Is there anyway that someone could make me a .hex file from this .asm, or at least tell me how?

Hey, I have a .asm file. I have tried MPLAB, but I am not doing it right. ;-----------------------------------------------------------------------; ; BINCLOCK.ASM A clock that displays in bcd numbers ; ;-----------------------------------------------------------------------;         LIST P=16F84 ; tells which processor is used         INCLUDE "p16f84.inc" ; defines various registers etc. Look it over.         ERRORLEVEL -224 ; supress annoying message because of tris         __CONFIG _PWRTE_ON & _LP_OSC & _WDT_OFF ; configuration switches             CBLOCK 0CH                 sec ; seconds digit                 sec10 ; 10's of second digit                 mins ; minutes digit                 min10 ; 10's of minutes digit                 hr ; hours digit                 hr10 ; 10's of hours digit                 w_temp ; holds W during interrupt                 status_temp ; holds STATUS during interrupt                 fsr_temp ; holds FSR during interrupt                 button ; holds mask for pushbuttons               ENDC ;-----------------------------------------------------------------------; ; Here are some DEFINEs which give 'names' to pushbutton port bits ; ;-----------------------------------------------------------------------;             #DEFINE SETPB PORTB, 4             #DEFINE SELECTPB PORTB, 5             #DEFINE SHOWPB PORTB, 6             ORG 0 ; start at location 0             goto main ; jump over to main routine ORG 4 goto isr ; jump to interrupt routine ;-----------------------------------------------------------------------; ; High limit + 1 of digits at position W ; ;-----------------------------------------------------------------------; sethi: addwf PCL, f dt H'A',H'6',H'A',H'6',H'A',H'3' ;-----------------------------------------------------------------------; ; Delay routines ; ;-----------------------------------------------------------------------; msec250: ; enter here to delay for 250 milliseconds movlw D'250' nmsec: ; delay for # msec in W on entry nop ; each nop is 0.122 milliseconds nop nop ; each total loop is 8 X 0.122 = 0.976 msec nop addlw H'FF' ; same as subtracting 1 from W btfss STATUS, Z ; skip if result is zero goto nmsec ; this is 2 X 0.122 msec return ; back to calling point ;-----------------------------------------------------------------------; ; Delay for one second ; ;-----------------------------------------------------------------------; onesecond: ; a subroutine that delays for 1 seconds call msec250 call msec250 call msec250 call msec250 return ;-----------------------------------------------------------------------; ; Put value in W on LEDs for 1 second ; ;-----------------------------------------------------------------------; sendnbr: movwf PORTB ; light LEDs call onesecond ; wait 1 second clrf PORTB ; clear the LEDs movlw D'100' ; pause for 0.1 sec call nmsec return ;-----------------------------------------------------------------------; ; Send the current time out LEDs ; ;-----------------------------------------------------------------------; disptime: movf hr10, W call sendnbr movf hr, W call sendnbr movf min10, W call sendnbr movf mins, W call sendnbr return ;-----------------------------------------------------------------------; ; Wait until selected button is released ; ;-----------------------------------------------------------------------; waitup6: ; wait for show pushbutton up movlw B'01000000' ; RB6 mask movwf button goto wait waitup5: ; wait for select pushbutton up movlw B'00100000' ; RB5 mask movwf button goto wait waitup4: ; wait for set pushbutton up movlw B'00010000' ; RB4 mask movwf button wait: movf button, W ; mask into W andwf PORTB, W btfsc STATUS, Z ; skip if not zero (released) goto wait movlw D'10' call nmsec ; wait 10 msec for debounce movf button, W ; check for release again andwf PORTB, W btfsc STATUS, Z ; skip if selected button released goto wait return ; yes, finished ;-----------------------------------------------------------------------; ; Initilization Subroutine ; ;-----------------------------------------------------------------------; init: movlw B'0000000' ; all outputs port A tris PORTA movlw B'01110000' ; RB4 - RB6 inputs, others outputs tris PORTB ; on port B movlw H'0' ; all low (off) movlw PORTB movlw B'00000100' ; pull-ups enabled ; prescaler assigned to TMR0 ; prescaler set to 1:32 ; rolls over each second option movlw 0 movwf hr10 movlw H'9' ; initialize hrs, mins and secs movwf hr ; Do this before interrupts are movlw H'5' ; turned on because isr also acts movwf min10 ; on these registers movlw H'0' movwf mins movwf sec10 movwf sec movlw B'10100000' ; GIE & T0IE set, T0IF cleared movwf INTCON return ;-----------------------------------------------------------------------; ; Interrupt routine, increments time by one second (BCD) ; ;-----------------------------------------------------------------------; isr: movwf w_temp ; save W swapf STATUS,W ; save status movwf status_temp ; without changing flags swapf FSR,W ; save FSR movwf fsr_temp ; without changing flags movlw sec ; point at sec register movwf FSR newdigit: incf INDF, f ; current digit up one movlw sec ; get difference between sec and FSR subwf FSR, W call sethi ; use to get high limit + 1 subwf INDF, W ; reached that number yet? btfss STATUS, Z ; skip over if yes goto restore ; else exit isr clrf INDF ; set current digit to 0 incf FSR, f ; point at next digit btfss hr10, 1 ; has hr10 reached 2? goto newdigit ; no, increment the next digit btfss hr, 2 ; has hr reached 4? goto newdigit ; no clrf hr ; yes, set hour to 00 clrf hr10 ; and hour 10 restore: swapf status_temp,W ; get original status back movwf STATUS ; into status register swapf fsr_temp,W ; get original fsr back movwf FSR ; into status register swapf w_temp,f ; old no flags trick again swapf w_temp,W ; to restore W bcf INTCON,T0IF ; clear the TMR0 interrupt flag retfie ; finished reset GIE ;-----------------------------------------------------------------------; ; Increment and display digit pointed to by FSR ; ;-----------------------------------------------------------------------; updigit: incf INDF, f ; selected digit up one movlw mins ; set up to subtract mins address subwf FSR, W ; from address of current digit call sethi ; get maximum of digit + 1 into W subwf INDF, W ; is it = to current digit value? btfsc STATUS, Z ; gives zero if yes, skip if no clrf INDF ; reset value of digit to zero movf INDF, W ; get current value and .. movwf PORTB ; display it call onesecond ; pause for 1 second return ;-----------------------------------------------------------------------; ; increment selected digit until select pressed ; ;-----------------------------------------------------------------------; setdigit: movwf PORTB btfss SETPB ; set pressed? call updigit ; yes btfsc SELECTPB ; check if select pressed goto $ -3 ; repeat till select pressed again call waitup5 ; make sure select released incf FSR, f return ;-----------------------------------------------------------------------; ; Select and increment digits ; ;-----------------------------------------------------------------------; select: bcf INTCON, GIE ; no interrupts while setting time movlw mins ; point at minutes register movwf FSR call waitup5 ; wait on select pushbutton up movlw B'00000001' ; light right LED (mins) call setdigit movlw B'00000010' ; light min10 LED call setdigit movlw B'00000100' ; light hr LED call setdigit movlw B'00001000' ; hr10 LED on call setdigit clrf PORTB ; clear LEDs bsf INTCON, GIE ; enable interrupts again return ;-----------------------------------------------------------------------; ; The main routine ; ;-----------------------------------------------------------------------; main: call init ; set up initial conditions loop: btfss SHOWPB ; check for show pushbutton call disptime ; display the time btfss SELECTPB ; check for select call select goto loop ; do forever end     

Question by 16zzundel5 7 years ago  |  last reply 7 years ago


how to power a circular rail Carriage

Hello. Looking for ideas on how a circular rail carriage could be powered. Here is what i am looking at  http://www.ghbinroth.com/nadella/nadella-multimotion-line-fsr-system.pdf https://www.alibaba.com/product-detail/High-Quality-And-Precision-Circular-Guide_1974565028.html On a linear rail its common to use 8mm Acme Lead Screw to translate the nema rotation movement..how is this done on circular carriage like the links above.  thanks

Question by davvito 1 year ago  |  last reply 1 year ago


assembly program

I have pic12f675. i have the neccessary asm and the header files.but i cannot compile it. please can you send me the hex file after compiling the program? as iam a student of class 8, idon't know how to compile. can you also send me the required steps? The required files are posted ;******************************* ;;LED FX.asm ;  11-3-2010 ;******************************* list p=12F629 radix dec include "p12f629.inc"   errorlevel -302 ; Dont complain about BANK 1 Registers during assembly __CONFIG _MCLRE_OFF & _CP_OFF & _WDT_OFF & _INTRC_OSC_NOCLKOUT  ;Internal osc. ;_MCLRE_OFF  - master clear must be off for gp3 to work as input pin ;**************************************************************** ; variables - names and files ;**************************************************************** temp1  equ 20h ; temp2  equ 21h ; temp3  equ 22h ; temp4  equ 23h ; jump  equ 24h ;jump value for table1 fadeUp  equ 25h fadeDwn  equ 26h sequences equ 27h sw_duration equ 28h testing  equ 29h ;**************************************************************** ;Equates ;**************************************************************** status  equ 0x03 rp1   equ 0x06 rp0   equ 0x05 GPIO   equ 0x05    status  equ 03h option_reg equ 81h   ; bits on GPIO     pin7  equ 0 ;GP0  LED C pin6   equ 1 ;GP1  LED B pin5  equ 2 ;GP2  LED A pin4  equ 3 ;GP3  Sw A  pin3  equ 4 ;GP4  Sw B pin2  equ 5 ;GP5  Sw C     ;bits     rp0   equ 5   ;bit 5 of the status register ;**************************************************************** ;Beginning of program ;****************************************************************   org  0x00   nop   nop   nop   nop   nop   SetUp bsf  status, rp0  ;Bank 1           movlw b'11111000'  ;Set TRIS  GP0,1,2 out   GP3,4,5 input   movwf TRISIO         ;    bcf  status, rp0  ;bank 0   movlw   07h          ;turn off Comparator ports         movwf   CMCON        ;must be placed in bank 0    clrf  GPIO         ;Clear GPIO of junk   call _memory   btfss gpio,5   ;SwA to: "record new sequence"    goto record     btfsc gpio,3  ;SwC removes attract sequence   goto $+.10    movlw 0FFh   bsf  status,rp0 ;select bank1   movwf EEDATA        bcf  status,rp0 ;select bank0   movlw .101   bsf  status,rp0 ;select bank1   movwf EEADR      bcf  status,rp0 ;select bank0   call  write     movlw .101   bsf  status,rp0     movwf EEADR           bsf  EECON1,0 ;starts EEPROM read operation storing result in EEDATA        movf EEDATA,w ;move read data into w   bcf  status,rp0      xorlw .8   ;look for 8 - for Attract mode   btfsc 03,2   goto Attract_Seq ;selected sequence will appear first   goto  Main         ;**************************************************************** ;* Tables    * ;**************************************************************** table1 addwf   PCL,F           ;02h,1  add W to program counter   retlw   .10     ;   retlw   .50         retlw   .30     ;   retlw   .50         retlw   .100     ;   retlw   .40  ; program starts at bottom of table   retlw   .10     ;   retlw   .50         retlw   .30     ;   retlw   .50         retlw   .60     ;   retlw   .10     ;   retlw   .50         retlw   .10     ;   retlw   .50         retlw   .100     ;   retlw   .20     ;   retlw   .50         retlw   .30     ;   retlw   .50         retlw   .70   retlw   .60     ;   retlw   .100     ;   retlw   .50         retlw   .100     ;   retlw   .50         retlw   .100     ;   retlw   .70     ;   retlw   .50         retlw   .30     ;   retlw   .50         retlw   .70     ;   table2 addwf   PCL,F           ;02h,1  add W to program counter   goto seq1     goto seq2     goto seq3     goto seq4     goto seq5     goto seq6     goto seq7     goto seq8     goto seq9     goto seq10   goto seq11       goto seq12  ;**************************************************************** ;* Delays    * ;**************************************************************** _xuS movwf temp2 _uS  movlw .10   movwf temp1   decfsz temp1,f   goto $-1      decfsz  temp2,f   goto  _uS    retlw  00   _ZuS movwf temp2   goto $+2   goto $+2    decfsz  temp2,f   goto  $-3    retlw  00  _xmS movwf temp2 _x  nop   decfsz  temp1,f   goto  _x   decfsz  temp2,f   goto  _x   retlw  00     ;5mS delay for increments in timing for "New Sequence"   _5mS movlw 05h   movwf temp2 _5  nop   decfsz  temp1,f   goto  _5   decfsz  temp2,f   goto  _5   retlw  00     _10mS movlw 0Ah   movwf temp2 _10  nop   decfsz  temp1,f   goto  _10   decfsz  temp2,f   goto  _10   retlw  00    _50mS movlw .50   movwf temp2 _50  nop   decfsz  temp1,f   goto  _50   decfsz  temp2,f   goto  _50   retlw  00   _100mS movlw .100   movwf temp2 _100 nop   decfsz  temp1,f   goto  _100   decfsz  temp2,f   goto  _100   retlw  00     _150mS movlw .150   movwf temp2 _150 nop   decfsz  temp1,f   goto  _150   decfsz  temp2,f   goto  _150   retlw  00       ;**************************************************************** ;* Sub Routines    * ;****************************************************************    _memory        movlw .48   movwf temp1   movlw 2Fh   movwf fsr   incf fsr,f   movlw 0FFh   movwf indf   decfsz temp1,f   goto $-4   retlw 00        ;SwB puts current sequence into EEPROM for turn on.      ;and puts "marker" in location 101      Attract   movf sequences,w ;put sequence number into w   bsf  status,rp0 ;select bank1   movwf EEDATA        bcf  status,rp0 ;select bank0   movlw .100   bsf  status,rp0 ;select bank1   movwf EEADR      bcf  status,rp0 ;select bank0   call  write   movlw .8   bsf  status,rp0 ;select bank1   movwf EEDATA      incf EEADR,1      bcf  status,rp0 ;select bank0   call  write    nop   goto $-1   ;Project must be turned off       ;Seq selected as Attract will be displayed when project turned on     Attract_Seq   movlw .100   bsf  status,rp0     movwf EEADR           bsf  EECON1,0 ;starts EEPROM read operation. Result in EEDATA        movf EEDATA,w ;move read data into w   bcf  status,rp0   movwf temp4   movf temp4,w      call table2    goto $-2    ;record new sequence - looks for "no switch pressed" for 1.25 seconds to exit   ;uses files 30h to 5Fh  (48 files)   ;three files per "step"   1st file = LEDs,  2nd = Off time, 3rd = on time   ;15 steps allowed - look for 5Dh   record btfss gpio,5  ;wait for release of button A   goto $-1   movlw 30h   movwf fsr   ;start storage at file 30h      ;look at keys being pressed - identifies 2 or 3 keys pressed together    _r1  clrf sw_duration _r1a call _5mS   incfsz sw_duration,1  ;5mS x 256 = 1.25seconds   goto $+2   goto Store  ;time out! store files 30h to 5Fh in EEPROM    btfss gpio,5  ;see if one or more Sw is pressed   goto $+5   btfss gpio,4   goto $+3   btfsc gpio,3   goto _r1a  ;no sw pressed create 2.5 sec timing        ;1,2,or 3 sw pressed     call _10mS  ;delay to detect 2 or 3 switches   incfsz sw_duration,1   goto $+2   goto Main    btfsc gpio,5  ;SwA   goto $+2   bsf  gpio,0  ;turn on LED A    btfsc gpio,4  ;SwB   goto $+2   bsf  gpio,1  ;turn on LED B    btfsc gpio,3  ;SwC   goto $+2   ;   bsf  gpio,2  ;turn on LED C        ;LEDs have been illuminated         movf gpio,w    movwf indf   ;w moved to fsr's file (30h+)       incf fsr,f     movf sw_duration,w ;off time!!   movwf indf   ;w moved to fsr's file (30h+)      incf fsr,f    clrf sw_duration       _r2  call _5mS   incfsz sw_duration,1       goto $+2   goto record  ;time out! keys pressed too long. Start again   btfss gpio,5   goto _r2   ;sw pressed   btfss gpio,4   goto _r2   ;sw pressed   btfss gpio,3   goto _r2   ;sw pressed          ;file empty. Put duration into file   movf sw_duration,w ;on time      movwf indf   ;w moved to fsr's file (30h+)       incf fsr,f     movlw 5Dh   xorwf fsr,w   btfss 03,2      goto $+2   goto Store  ;stop at 15 steps. store files 30h to 5Fh in EEPROM      clrf gpio    goto _r1          ;sequences:       ;seq1 Self-Programmed sequence    ;1St file:LEDs  2nd file:OFF time  3rd file:On time    seq1 bsf  status,rp0     clrf EEADR    bcf  status,rp0    bsf  status,rp0       bsf  EECON1,0 ;starts EEPROM read operation. Result in EEDATA        movf EEDATA,w ;move read data into w   bcf  status,rp0      movwf gpio   bsf  status,rp0   incf EEADR,1        bsf  EECON1,0 ;        movf EEDATA,w ;move read data into w   bcf  status,rp0    movwf temp4 ;this is OFF time. Store it   bsf  status,rp0   incf EEADR,1        bsf  EECON1,0 ;        movf EEDATA,w ;move read data into w   bcf  status,rp0    movwf sw_duration ;this is ON time   call _5mS   decfsz sw_duration,1   goto $-2   clrf gpio   call _5mS   decfsz temp4,f ;create OFF duration   goto $-2    bsf  status,rp0   incf EEADR,1        bsf  EECON1,0 ;        movf EEDATA,w ;move read data into w   bcf  status,rp0     xorlw 0FFh ;look for 0FFh - end of routine   btfss 03,2   goto $-31   retlw 00          ;seq2  chase right - very fast     seq2 bsf  gpio,0   call _100mS   bcf  gpio,0   bsf  gpio,1   call _100mS   bcf  gpio,1   bsf  gpio,2   call _100mS   bcf  gpio,2   call _100mS   clrf gpio   retlw 00     ;seq3  chase right     seq3 bsf  gpio,0   call _150mS   bcf  gpio,0   bsf  gpio,1   call _150mS   bcf  gpio,1   bsf  gpio,2   call _150mS   bcf  gpio,2   call _150mS   clrf gpio   retlw 00     ;seq4  chase right with off-delay at end     seq4 bsf  gpio,0   call _150mS   bcf  gpio,0   bsf  gpio,1   call _150mS   bcf  gpio,1   bsf  gpio,2   call _150mS   bcf  gpio,2   call _150mS    retlw 00     ;seq5  left right left right   seq5 bsf  gpio,0   call _150mS   bcf  gpio,0    bsf  gpio,2   call _150mS   bcf  gpio,2      retlw 00       ;seq6  middle on   middle off   seq6 bsf  gpio,1   call _150mS   bcf  gpio,1   call _150mS     clrf gpio     retlw 00         ;seq7  All on   all off   seq7 clrf gpio   call _150mS   decf gpio,f   call _150mS   clrf gpio       retlw 00     seq8 ;seq8  middle on then sides on      bsf  gpio,1   call _150mS   bcf  gpio,1   bsf  gpio,0   bsf  gpio,2   call _150mS   clrf gpio       retlw 00     ;seq9  police flasher  3 times left 3 times right   seq9 bsf  gpio,0   call _50mS   bcf  gpio,0   call _50mS   bsf  gpio,0   call _50mS   bcf  gpio,0   call _50mS   bsf  gpio,0   call _50mS   bcf  gpio,0   call _50mS    bsf  gpio,2   call _50mS   bcf  gpio,2   call _50mS   bsf  gpio,2   call _50mS   bcf  gpio,2   call _50mS   bsf  gpio,2   call _50mS   bcf  gpio,2   clrf gpio   call _50mS      retlw 00     ;seq10  random flicker   seq10 movlw .32  ;start at bottom of table   movwf jump   bsf  gpio,1   movf jump,w ;put table jump value into w   call  table1   call _xmS   bcf  gpio,1   decfsz jump,f   goto $+2   retlw 00  ;top of table found   movf jump,w ;put table jump value into w   call  table1   call _xmS      goto $-11       ;seq11  slow fade up down   seq11 clrf fadeUp  ;   clrf fadeDwn   incf fadeUp,f ;to create 1 (delay routine does not like 00)   bsf  gpio,1   movf fadeUp,w   call _xuS   bcf  gpio,1   movf fadeDwn,w   call _xuS         decfsz fadeDwn,f ;   goto $-8   incf fadeDwn,f ;to produce 1   bsf  gpio,1   movf fadeUp,w   call _xuS   bcf  gpio,1   movf fadeDwn,w   call _xuS   decf fadeUp,f     incfsz fadeDwn,f    goto $-8     clrf gpio   retlw 00       ;seq12  fast fade up down   seq12 clrf fadeUp  ;   clrf fadeDwn   incf fadeUp,f ;to create 1 (delay routine does not like 00)   bsf  gpio,1   movf fadeUp,w   call _ZuS   bcf  gpio,1   movf fadeDwn,w   call _ZuS         decfsz fadeDwn,f ;   goto $-8   incf fadeDwn,f ;to produce 1   bsf  gpio,1   movf fadeUp,w   call _ZuS   bcf  gpio,1   movf fadeDwn,w   call _ZuS   decf fadeUp,f     incfsz fadeDwn,f    goto $-8     clrf gpio   retlw 00        ;Store   Store the 15 steps in EEPROM    Store bsf  status,rp0 ;select bank1   clrf eeadr        bcf  status,rp0 ;select bank0    movlw .48   movwf temp1   movlw 2Fh   movwf fsr   incf fsr,f ;fsr starts at file 30h   movf indf,w ;retreive data in file 30h   bsf  status,rp0 ;select bank1   movwf eedata  ;   bcf  status,rp0 ;select bank0   call  write   bsf  status,rp0 ;select bank1   incf eeadr,1        bcf  status,rp0 ;select bank0   decfsz temp1,f   goto $-10   goto Main       write bsf  status,rp0 ;select bank1   bsf  eecon1,wren ;enable write    movlw 55h   ;unlock codes   movwf eecon2   movlw 0aah   movwf eecon2   bsf  eecon1,wr ;write begins   bcf  status,rp0 ;select bank0  writeA btfss pir1,eeif ;wait for write to complete   goto writeA   bcf  pir1,eeif   bsf  status,rp0 ;select bank1   bcf  eecon1,wren ;disable other writes   bcf  status,rp0 ;select bank0       retlw 00           ;**************************************************************** ;* Main        * ;**************************************************************** Main clrf sequences   movf sequences,w   call table2   btfss gpio,5  ;Is swA still pressed?   goto $-3   ;SwA still pressed    movf sequences,w ;SwA released   call table2   btfss gpio,4  ;SwB puts current sequence at turn-on   goto Attract   btfsc gpio,5   goto $-5   ;SwA not pressed   incf sequences,f   movlw .12   xorwf sequences,w   btfss 03,2   goto $-12   goto Main      ;**************************************************************** ;*EEPROM           * ;****************************************************************           org  2100h                 END

Question by sahebpanda2001 4 years ago  |  last reply 4 years ago


Reporting plagarism: Arduino Hydroponics

Hello, It has recently come to my attention that an instructable here was blatently plagiarized from one of my previous projects, and in fact actually won an award. The instructable in question is: https://www.instructables.com/id/Hyduino-Automated-Hydroponics-with-an-Arduino/ Proof that it ripped off my project can be found here; my original forum post here goes back to 2012, the instructable in question here was posted November 2014: http://forum.arduino.cc/index.php?topic=130344.180  My repository containing my code on github: https://github.com/BillieBricks/Billie-s-Hydroponic-Controller/blob/master/HydroponicControllerV1.1.0 The code from the instructable in question: https://www.instructables.com/files/orig/FSR/83MH/I2G1F678/FSR83MHI2G1F678.ino The code is mine, line for line, with the exception that the plagiarizing author in question removed my comment at the top with my name as the author. I tried to contact the author, but my messages went ignored and the comments on his instructable page were flagged and deleted.  The author in his instructable says "Big thanks to BillieBricks for working out a lot of the code," but in fact the entirety of the code is simply ripped straight off from my project, along with the ideas and implimentation. My desired outcome would be to either see this instructable removed, or to have the author include that the entire project be credited to me, rather than stealing credit for something they didn't do.  Thank you, Billie

Topic by BillieBricks 4 years ago  |  last reply 4 years ago


[newsletter] 17-Foot Gandhi, BBQ Tips, Sweet Tea...

July 10, 2008 Sign-up for this newsletter: function openSubscribePopUp(src){ var emailValidate = /\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/ if(emailValidate.test(src.value) == false){ alert("Please enter correct email"); return; } window.open("/newsletter/newslettersignup?email=" + src.value,"newslettersignup1","status=yes,scrollbars=yes,resizable=yes,width=420,height=250"); } Welcome back! The Robot Contest ends this weekend! Make the most of that extension we gave you, add some finishing touches, enter your Instructable by Sunday night! The Horny Toad Invent-a-Sport Contest starts today! Win lots of cool clothes from Horny Toad by sharing your own original sport or game.The winners from the BBQ PDQ Contest have been announced. See who won!There's now an Instructables page on Facebook. Become a fan, post on the wall, and even upload some pictures or videos. Four Square Chair by wholman RC truck robot conversion by OracsRevenge Best FREE Things to do at Disney World by woofboy111 BBQ: Fall Off the Bone Beef Ribs by Mr. Rig It Smashed Mutant Octopus book "shelf" by Sunbanks Night Stand Charging Station Lamp by drocko BBQ Hero - slow cooking, smoking, and sauce bars by dave spencer DIY Force Sensitive Resistor (FSR) by kylemcdonald Southern-style Sweet Tea for Summertime by reno_dakota How to Climb a Tree (with prussiks!) by stasterisk Glass Dining Room Table "Etching" by Code128 Bumcamping in Japan by TimAnderson Win cool clothes from Horny Toad! Get published in the Instructables book! See who won! Build a thruster for a submersible or ROV by Kajnjaps Pulled Pork by Ticking-Timebomb A New Desk... From A Dresser by MercuryCrest 17-Foot Tall Cardboard Gandhi by delappe Now go make something awesome, and I'll see you next week! - Eric Sign-up for this newsletter: function openSubscribePopUp(src){ var emailValidate = /\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/ if(emailValidate.test(src.value) == false){ alert("Please enter correct email"); return; } window.open("/newsletter/newslettersignup?email=" + src.value,"newslettersignup2","status=yes,scrollbars=yes,resizable=yes,width=420,height=250"); }

Topic by fungus amungus 10 years ago  |  last reply 10 years ago


NEW 2009 Rocky Mountain Element Team Mountain Bike $2,000

dessy.richard@yahoo.com bikeworld.world@gmail.com.Dear Customer, Rocky Mountain Eleme BilNEW 2008/2009 l Bike world Ltd is one of the leading bike distributors.We are Legitimate registered Company under licensed number(RC43315).We ship via FedEx,UPS or DHL, and your ordered items will get to your door step within 48 hrs(Two Working Day).We sell all kinds Cannondale, Cervelo, Ellsworth, Giant, Jamis, Klein, Kona, Litespeed, Rocky Mountain, Santa Cruz, Specialized, Trek, Gary Fisher bikes Here are some of our price list: NEW Cervelo P2C Ultegra Bicycle - 2008-CRV8P2CU....$2000 NEW 2009 Cannondale Road Tandem Bike....... $1,600 NEW 2009 Cannondale F4000 SL Mountain Bike..... $2,400 NEW 2009 Cannondale Gemini 900 Mountain Bike..... $1,200 NEW 2009 Cannondale Mountain Tandem Bike..... $1,200 NEW 2009 Cannondale Prophet 4000 Mountain Bike..... $2,600 NEW 2009 Cannondale R1000 Road Bike..... $1,000 NEW 2009 Cannondale Scalpel 3000 Mountain Bike.... $2,600 NEW 2009 Cannondale Six13 Team 1 Dura Ace Road Bike..... $2,400 NEW 2009 Cervelo Soloist Carbon Road Bike..... $2,800 NEW 2009 Cervelo P3 Carbon Road Bike..... $3,200 NEW 2009 Cervelo Soloist Team Road Bike..... $1,900 NEW 2009 Ellsworth Epiphany Mountain Bike..... $3,000 NEW 2009 Ellsworth Moment Mountain Bike..... $3,400 NEW 2009 Ellsworth Truth Mountain Bike..... $2,800 NEW 2009 Gary Fisher Cake 1 DLX Mountain Bike..... $1,700 NEW 2009 Giant Anthem 1 Mountain Bike..... $1,200 NEW 2008 Santa Cruz Blur LT Mountain Bike $2,200 NEW 2008 Santa Cruz Nomad Mountain Bike $2,000 NEW 2008 Santa Cruz V 10 Mountain Bike $2,200 NEW 2008 Specialized Demo 8 Mountain Bike $2,000 NEW 2008 Specialized Enduro SL Pro Carbon Mountain Bike $2,100 NEW 2008 Specialized Epic Comp Mountain Bike $1,150 NEW 2008 Specialized Epic Marathon Mountain Bike $1,700 NEW 2008 Specialized Roubaix Pro Road Bike $1,700 NEW 2008 Specialized Ruby Pro Road Bike $1,700 NEW 2008 Specialized S-Works Stumpjumper Fsr Carbon Bike $2,300 NEW 2008 Specialized S-Works Tarmac SL Sram Road Bike $2,300 NEW 2008 Specialized S-Works Roubaix Dura Ace Road Bike $2,300 NEW 2008 Specialized Stumpjumper Comp Mountain Bike $1,000 NEW 2008 Specialized Tarmac Pro Double Road Bike $1,700 NEW 2008 Specialized Transition Pro Road Bike $1,700 NEW 2009 MARIN Juinper Trail Bike $900 NEW 2009 MARIN Wildcat Trail Bike $1,200 NEW 2009 MARIN Alpine Trail Bike $1,300 NEW 2009 MARIN East Peak Bikw $1,550 NEW 2009 MARIN Rock Springs Bike $1,300 NEW 2009 MARIN Rift Zone Bike $1,400 NEW 2009 MARIN Rift Zone SE Bike $ 1,300 NEW 2009 MARIN Wolf Ridge Bike $1,600 NEW 2009 MARIN Mount Vision Bike $1,800 NEW 2009 MARIN Attack Trail Bike $1,810 NEW 2009 MARIN Mount Vision Pro Bike $2,600 NEW 2009 Cannondale Road Tandem Bike $1,100 NEW 2009 Cannondale F4000 SL Mountain Bike $2,300 NEW 2009 Cannondale Gemini 900 Mountain Bike $1,100 NEW 2009 Cannondale Mountain Tandem Bike $1,100 NEW 2009 Cannondale Prophet 4000 Mountain Bike $2,500 NEW 2009 Cannondale R1000 Road Bike $1,000 NEW 2009 Cannondale Scalpel 3000 Mountain Bike $2,500 NEW 2009 Cannondale Six13 Team 1 Dura Ace Road Bike $2,300 NEW 2009 Klein Q-Pro XV Road Bike $1,200 NEW 2009 Kona Dawg Primo Mountain Bike $1,100 NEW 2009 Kona Kula Supreme Mountain Bike $1,800 NEW 2009 Kona Stinky Mountain Bike $1,000 NEW 2009 Kona Kula Lisa Mountain Bike $1,000 NEW 2009 Kona Four Lisa Mountain Bike $1000 NEW 2009 Kona Blast Deluxe - Gold - SRP $900 NEW 2009 Cervelo Soloist Carbon Road Bike $2,200 NEW 2009 Cervelo P3 Carbon Road Bike $2,200 NEW 2009 Cervelo Soloist Team Road Bike $1,100 NEW 2009 Ellsworth Epiphany Mountain Bike $2,400 NEW 2009 Ellsworth Moment Mountain Bike $2,500 NEW 2009 Ellsworth Truth Mountain Bike $2,100 NEW 2009 Gary Fisher Cake 1 DLX Mountain Bike $1,400 NEW 2009 Giant Anthem 1 Mountain Bike $1,100 NEW 2009 Giant Reign X0 Mountain Bike $1,700 NEW 2009 Giant Tcr Composite 1 Road Bike $1,400 NEW 2009 Giant Trance 1 Mountain Bike $1,100 NEW 2009 Jamis Dakar XC Pro Mountain Bike $1,800 NEW 2009 Litespeed Bella Road Bike $1,100 NEW 2009 Litespeed Ghisallo Road Bike $2,500 NEW 2009 Litespeed Niota Ti Mountain Bike $2,700 NEW 2009 Litespeed Tuscany Road Bike $1,700 NEW 2009 Rocky Mountain Element Team Mountain Bike $2,000 NEW 2009 Rocky Mountain Slayer 70 Mountain Bike $1,600 NEW 2009 Trek 5000 Road Bike $1,100 NEW 2009 Trek Pilot SL 5.9 Road Bike $1,800 NEW 2009 Trek Tandem T 2000 Road Bike $1,400 NEW 2009 Trek Madone SSL 6.9 Road Bike $2,800 NEW 2009 Trek Top Fuel SL Mountain Bike $2,800 Get back to me with your full order if you are really interested in buying from us via email regards,sales manager.

Topic by dessy 10 years ago


: Arduino + Adafruit wave sheild + IR + Keypad sound board

Hi , was wondering if you could point me in the right direction I'm very new to Arduino I built last year a simple board with adafruit wave shield and added a simple 12 digit key pad to play 12 sounds + power up I have got the codes for the KEYES IR receiver so know the IR is correctly connected and library loaded im trying to integrate the IR code so can change the sounds by IR remote ideally with option of the buttons (if have to loose the buttons and just use remote that's fine) have copied the code below for how it works now just buttons   I found some code for Cylon Pumpkin that works great with just the remote but would also like to integrate the 12 digit keypad Thank you in advance for any help or pointers you can suggest Richard CODE FOR 12 DIGIT BUTTON PRESS /* ADAVOICE is an Arduino-based voice pitch changer plus WAV playback. Fun for Halloween costumes, comic convention getups and other shenanigans! Hardware requirements: - Arduino Uno, Duemilanove or Diecimila (not Mega or Leonardo compatible). - Adafruit Wave Shield - Speaker attached to Wave Shield output - Battery for portable use If using the voice pitch changer, you will also need: - Adafruit Microphone Breakout - 10K potentiometer for setting pitch (or hardcode in sketch) If using the WAV playback, you will also need: - SD card - Keypad, buttons or other sensor(s) for triggering sounds Software requirements: - WaveHC library for Arduino - Demo WAV files on FAT-formatted SD card This example sketch uses a 3x4 keypad for triggering sounds...but with some changes could be adapted to use several discrete buttons, Hall effect sensors, force-sensing resistors (FSRs), I2C keypads, etc. (or if you just want the voice effect, no buttons at all). Connections: - 3.3V to mic amp+, 1 leg of potentiometer and Arduino AREF pin - GND to mic amp-, opposite leg of potentiometer - Analog pin 0 to mic amp output - Analog pin 1 to center tap of potentiometer - Wave Shield output to speaker or amplifier - Matrix is wired to pins A2, A3, A4, A5 (rows) and 6, 7, 8 (columns) - Wave shield is assumed wired as in product tutorial Potentiometer sets playback pitch. Pitch adjustment does NOT work in realtime -- audio sampling requires 100% of the ADC. Pitch setting is read at startup (or reset) and after a WAV finishes playing. POINT SPEAKER AWAY FROM MIC to avoid feedback. Written by Adafruit industries, with portions adapted from the 'PiSpeakHC' sketch included with WaveHC library. */ #include #include SdReader card; // This object holds the information for the card FatVolume vol; // This holds the information for the partition on the card FatReader root; // This holds the information for the volumes root directory FatReader file; // This object represent the WAV file for a pi digit or period WaveHC wave; // This is the only wave (audio) object, -- we only play one at a time #define error(msg) error_P(PSTR(msg)) // Macro allows error messages in flash memory #define ADC_CHANNEL 0 // Microphone on Analog pin 0 // Wave shield DAC: digital pins 2, 3, 4, 5 #define DAC_CS_PORT PORTD #define DAC_CS PORTD2 #define DAC_CLK_PORT PORTD #define DAC_CLK PORTD3 #define DAC_DI_PORT PORTD #define DAC_DI PORTD4 #define DAC_LATCH_PORT PORTD #define DAC_LATCH PORTD5 uint16_t in = 0, out = 0, xf = 0, nSamples; // Audio sample counters uint8_t adc_save; // Default ADC mode // WaveHC didn't declare it's working buffers private or static, // so we can be sneaky and borrow the same RAM for audio sampling! extern uint8_t buffer1[PLAYBUFFLEN], // Audio sample LSB buffer2[PLAYBUFFLEN]; // Audio sample MSB #define XFADE 16 // Number of samples for cross-fade #define MAX_SAMPLES (PLAYBUFFLEN - XFADE) // Remaining available audio samples // Keypad information: uint8_t rows[] = { A2, A3, A4, A5 }, // Keypad rows connect to these pins cols[] = { 6, 7, 8, 9 }, // Keypad columns connect to these pins r = 0, // Current row being examined prev = 255, // Previous key reading (or 255 if none) count = 0; // Counter for button debouncing #define DEBOUNCE 10 // Number of iterations before button 'takes' // Keypad/WAV information. Number of elements here should match the // number of keypad rows times the number of columns, plus one: const char *sound[] = { "Crashing" , "Damaged", "InFlight" , "PowerUp" , // Row 1 = Darth Vader sounds "Brkdown3" , "Brkdown2" , "Brkdown" , "PowerUp" , // Row 2 = Godzilla sounds "Landing", "drain" , "Shutdown" , "PowerUp" , // Row 3 = Dug the dog sounds "Silent", "TakeOff", "Vortex" , "PowerUp" , // Row 4 = Cartoon/SFX sound "PowerUp" }; // Extra item = boot sound //////////////////////////////////// SETUP void setup() { uint8_t i; Serial.begin(9600); // The WaveHC library normally initializes the DAC pins...but only after // an SD card is detected and a valid file is passed. Need to init the // pins manually here so that voice FX works even without a card. pinMode(2, OUTPUT); // Chip select pinMode(3, OUTPUT); // Serial clock pinMode(4, OUTPUT); // Serial data pinMode(5, OUTPUT); // Latch digitalWrite(2, HIGH); // Set chip select high // Init SD library, show root directory. Note that errors are displayed // but NOT regarded as fatal -- the program will continue with voice FX! if(!card.init()) SerialPrint_P("Card init. failed!"); else if(!vol.init(card)) SerialPrint_P("No partition!"); else if(!root.openRoot(vol)) SerialPrint_P("Couldn't open dir"); else { PgmPrintln("Files found:"); root.ls(); // Play startup sound (last file in array). playfile(sizeof(sound) / sizeof(sound[0]) - 1); } // Optional, but may make sampling and playback a little smoother: // Disable Timer0 interrupt. This means delay(), millis() etc. won't // work. Comment this out if you really, really need those functions. TIMSK0 = 0; // Set up Analog-to-Digital converter: analogReference(EXTERNAL); // 3.3V to AREF adc_save = ADCSRA; // Save ADC setting for restore later // Set keypad rows to outputs, set to HIGH logic level: for(i=0; i pinMode(rows[i], OUTPUT); digitalWrite(rows[i], HIGH); } // Set keypad columns to inputs, enable pull-up resistors: for(i=0; i pinMode(cols[i], INPUT); digitalWrite(cols[i], HIGH); } while(wave.isplaying); // Wait for startup sound to finish... startPitchShift(); // and start the pitch-shift mode by default. } //////////////////////////////////// LOOP // As written here, the loop function scans a keypad to triggers sounds // (stopping and restarting the voice effect as needed). If all you need // is a couple of buttons, it may be easier to tear this out and start // over with some simple digitalRead() calls. void loop() { uint8_t c, button; // Set current row to LOW logic state... digitalWrite(rows[r], LOW); // ...then examine column buttons for a match... for(c=0; c if(digitalRead(cols[c]) == LOW) { // First match. button = r * sizeof(cols) + c; // Get button index. if(button == prev) { // Same button as before? if(++count >= DEBOUNCE) { // Yes. Held beyond debounce threshold? if(wave.isplaying) wave.stop(); // Stop current WAV (if any) else stopPitchShift(); // or stop voice effect playfile(button); // and play new sound. while(digitalRead(cols[c]) == LOW); // Wait for button release. prev = 255; // Reset debounce values. count = 0; } } else { // Not same button as prior pass. prev = button; // Record new button and count = 0; // restart debounce counter. } } } // Restore current row to HIGH logic state and advance row counter... digitalWrite(rows[r], HIGH); if(++r >= sizeof(rows)) { // If last row scanned... r = 0; // Reset row counter // If no new sounds have been triggered at this point, and if the // pitch-shifter is not running, re-start it... if(!wave.isplaying && !(TIMSK2 & _BV(TOIE2))) startPitchShift(); } } //////////////////////////////////// HELPERS // Open and start playing a WAV file void playfile(int idx) { char filename[13]; (void)sprintf(filename,"%s.wav", sound[idx]); Serial.print("File: "); Serial.println(filename); if(!file.open(root, filename)) { PgmPrint("Couldn't open file "); Serial.print(filename); return; } if(!wave.create(file)) { PgmPrintln("Not a valid WAV"); return; } wave.play(); } //////////////////////////////////// PITCH-SHIFT CODE void startPitchShift() { // Read analog pitch setting before starting audio sampling: int pitch = analogRead(1); Serial.print("Pitch: "); Serial.println(pitch); // Right now the sketch just uses a fixed sound buffer length of // 128 samples. It may be the case that the buffer length should // vary with pitch for better results...further experimentation // is required here. nSamples = 128; //nSamples = F_CPU / 3200 / OCR2A; // ??? //if(nSamples > MAX_SAMPLES) nSamples = MAX_SAMPLES; //else if(nSamples < (XFADE * 2)) nSamples = XFADE * 2; memset(buffer1, 0, nSamples + XFADE); // Clear sample buffers memset(buffer2, 2, nSamples + XFADE); // (set all samples to 512) // WaveHC library already defines a Timer1 interrupt handler. Since we // want to use the stock library and not require a special fork, Timer2 // is used for a sample-playing interrupt here. As it's only an 8-bit // timer, a sizeable prescaler is used (32:1) to generate intervals // spanning the desired range (~4.8 KHz to ~19 KHz, or +/- 1 octave // from the sampling frequency). This does limit the available number // of speed 'steps' in between (about 79 total), but seems enough. TCCR2A = _BV(WGM21) | _BV(WGM20); // Mode 7 (fast PWM), OC2 disconnected TCCR2B = _BV(WGM22) | _BV(CS21) | _BV(CS20); // 32:1 prescale OCR2A = map(pitch, 0, 1023, F_CPU / 32 / (9615 / 2), // Lowest pitch = -1 octave F_CPU / 32 / (9615 * 2)); // Highest pitch = +1 octave // Start up ADC in free-run mode for audio sampling: DIDR0 |= _BV(ADC0D); // Disable digital input buffer on ADC0 ADMUX = ADC_CHANNEL; // Channel sel, right-adj, AREF to 3.3V regulator ADCSRB = 0; // Free-run mode ADCSRA = _BV(ADEN) | // Enable ADC _BV(ADSC) | // Start conversions _BV(ADATE) | // Auto-trigger enable _BV(ADIE) | // Interrupt enable _BV(ADPS2) | // 128:1 prescale... _BV(ADPS1) | // ...yields 125 KHz ADC clock... _BV(ADPS0); // ...13 cycles/conversion = ~9615 Hz TIMSK2 |= _BV(TOIE2); // Enable Timer2 overflow interrupt sei(); // Enable interrupts } void stopPitchShift() { ADCSRA = adc_save; // Disable ADC interrupt and allow normal use TIMSK2 = 0; // Disable Timer2 Interrupt } ISR(ADC_vect, ISR_BLOCK) { // ADC conversion complete // Save old sample from 'in' position to xfade buffer: buffer1[nSamples + xf] = buffer1[in]; buffer2[nSamples + xf] = buffer2[in]; if(++xf >= XFADE) xf = 0; // Store new value in sample buffers: buffer1[in] = ADCL; // MUST read ADCL first! buffer2[in] = ADCH; if(++in >= nSamples) in = 0; } ISR(TIMER2_OVF_vect) { // Playback interrupt uint16_t s; uint8_t w, inv, hi, lo, bit; int o2, i2, pos; // Cross fade around circular buffer 'seam'. if((o2 = (int)out) == (i2 = (int)in)) { // Sample positions coincide. Use cross-fade buffer data directly. pos = nSamples + xf; hi = (buffer2[pos] << 2) | (buffer1[pos] >> 6); // Expand 10-bit data lo = (buffer1[pos] << 2) | buffer2[pos]; // to 12 bits } if((o2 < i2) && (o2 > (i2 - XFADE))) { // Output sample is close to end of input samples. Cross-fade to // avoid click. The shift operations here assume that XFADE is 16; // will need adjustment if that changes. w = in - out; // Weight of sample (1-n) inv = XFADE - w; // Weight of xfade pos = nSamples + ((inv + xf) % XFADE); s = ((buffer2[out] << 8) | buffer1[out]) * w + ((buffer2[pos] << 8) | buffer1[pos]) * inv; hi = s >> 10; // Shift 14 bit result lo = s >> 2; // down to 12 bits } else if (o2 > (i2 + nSamples - XFADE)) { // More cross-fade condition w = in + nSamples - out; inv = XFADE - w; pos = nSamples + ((inv + xf) % XFADE); s = ((buffer2[out] << 8) | buffer1[out]) * w + ((buffer2[pos] << 8) | buffer1[pos]) * inv; hi = s >> 10; // Shift 14 bit result lo = s >> 2; // down to 12 bits } else { // Input and output counters don't coincide -- just use sample directly. hi = (buffer2[out] << 2) | (buffer1[out] >> 6); // Expand 10-bit data lo = (buffer1[out] << 2) | buffer2[out]; // to 12 bits } // Might be possible to tweak 'hi' and 'lo' at this point to achieve // different voice modulations -- robot effect, etc.? DAC_CS_PORT &= ~_BV(DAC_CS); // Select DAC // Clock out 4 bits DAC config (not in loop because it's constant) DAC_DI_PORT &= ~_BV(DAC_DI); // 0 = Select DAC A, unbuffered DAC_CLK_PORT |= _BV(DAC_CLK); DAC_CLK_PORT &= ~_BV(DAC_CLK); DAC_CLK_PORT |= _BV(DAC_CLK); DAC_CLK_PORT &= ~_BV(DAC_CLK); DAC_DI_PORT |= _BV(DAC_DI); // 1X gain, enable = 1 DAC_CLK_PORT |= _BV(DAC_CLK); DAC_CLK_PORT &= ~_BV(DAC_CLK); DAC_CLK_PORT |= _BV(DAC_CLK); DAC_CLK_PORT &= ~_BV(DAC_CLK); for(bit=0x08; bit; bit>>=1) { // Clock out first 4 bits of data if(hi & bit) DAC_DI_PORT |= _BV(DAC_DI); else DAC_DI_PORT &= ~_BV(DAC_DI); DAC_CLK_PORT |= _BV(DAC_CLK); DAC_CLK_PORT &= ~_BV(DAC_CLK); } for(bit=0x80; bit; bit>>=1) { // Clock out last 8 bits of data if(lo & bit) DAC_DI_PORT |= _BV(DAC_DI); else DAC_DI_PORT &= ~_BV(DAC_DI); DAC_CLK_PORT |= _BV(DAC_CLK); DAC_CLK_PORT &= ~_BV(DAC_CLK); } DAC_CS_PORT |= _BV(DAC_CS); // Unselect DAC if(++out >= nSamples) out = 0; } CODE I FOUND FOR IR  ClyonPumpkin That I want to integrate in above   /* * Text-to-speech example to speak the first n digits of pi. * The number is stored in flash, each digit is spoken one at a time. */ #include #include #include SdReader card;    // This object holds the information for the card FatVolume vol;    // This holds the information for the partition on the card FatReader root;   // This holds the information for the volumes root directory FatReader file;   // This object represent the WAV file for a pi digit or period WaveHC wave;      // This is the only wave (audio) object, since we will only play one at a time char eyesound[13]="eye2.wav"; int mute = 0; /* * Define macro to put error messages in flash memory */ #define error(msg) error_P(PSTR(msg)) // IR Remote code int RECV_PIN = 9;  // pin 11 used by SD card interface so select pin 9 for IR IRrecv irrecv(RECV_PIN); decode_results results; long lasttime=0, lastcode=0, timediff=0; //////////////////////////////////// SETUP void setup() {   // set up Serial library at 9600 bps   Serial.begin(9600);               if (!card.init()) {     error("Card init. failed!");   }   if (!vol.init(card)) {     error("No partition!");   }   if (!root.openRoot(vol)) {     error("Couldn't open dir");   }   irrecv.enableIRIn(); // Start the IR receiver } /////////////////////////////////// LOOP void loop() {   if(mute == 0) playcomplete(eyesound);   // check for keypress happened   if (irrecv.decode(&results;)) {      Serial.println(results.value, HEX);      switch (results.value) {        case 0x83228B74:    // 1          playcomplete("command.wav");          break;        case 0x83228F70:    // 2          playcomplete("entertan.wav");          break;        case 0x8322906F:    // 3          playcomplete("extermin.wav");          break;        case 0x83228A75:    // 4          playcomplete("leader.wav");          break;        case 0x8322847B:    // 5          playcomplete("survivor.wav");          break;         case 0x83227887:    // 6          playcomplete("atention.wav");          break;        case 0x8322629D:    // vol up          mute = 0;         // mute off          break;         case 0x83226E91:    // mute          { Serial.println("mute detected");            timediff=millis()-lasttime;            Serial.println(timediff);            if(lastcode!=results.value || (lastcode==results.value && (timediff>1600)) ) {               if( mute == 0 ) { // is mute off?                  Serial.println("toggle off to on");                  mute = 1;      // turn on                  // delay(1000);    // wait a bit for debounce                  break;                 }               if( mute == 1 ) { // is mute on?                  mute = 0;      // turn off                  Serial.println("toggle on to off");                  break;                 }              } // end if             break;           } // end case        } // end switch      lastcode = results.value;      lasttime = millis();      irrecv.resume();   // Receive the next value   } } /////////////////////////////////// HELPERS /* * print error message and halt */ void error_P(const char *str) {   PgmPrint("Error: ");   SerialPrint_P(str);   sdErrorCheck();   while(1); } /* * print error message and halt if SD I/O error */ void sdErrorCheck(void) {   if (!card.errorCode()) return;   PgmPrint("\r\nSD I/O error: ");   Serial.print(card.errorCode(), HEX);   PgmPrint(", ");   Serial.println(card.errorData(), HEX);   while(1); } /* * Play a file and wait for it to complete */ void playcomplete(char *name) {   playfile(name);   while (wave.isplaying);     // see if an error occurred while playing   sdErrorCheck(); } /* * Open and start playing a WAV file */ void playfile(char *name) {   if (wave.isplaying) {// already playing something, so stop it!     wave.stop(); // stop it   }   if (!file.open(root, name)) {     PgmPrintln("Couldn't open file ");     Serial.print(name);     return;   }   if (!wave.create(file)) {     PgmPrintln("Not a valid WAV");     return;   }   // ok time to play!   wave.play(); }

Topic by SithLordIII 4 years ago