NOVELTY - Hydrogen and methane are prepared by pumping residual sludge generated in a sewage treatment process to a pre-treatment pond for thermal pre-treatment, cooling pre-treated product to room temperature, pumping cooled product to a closed first fermentation tank for anaerobic fermentation to prepare hydrogen, adding another batch of residual sludge to an adjusting pond, adjusting pH value, and pumping the mixture to a closed second fermentation tank for anaerobic fermentation to prepare methane.    USE - Method of preparing hydrogen and methane (claimed).    ADVANTAGE - The method recycles energy matters in the residual sludge, and is stepwise, simple, low cost and environment-friendly.    DETAILED DESCRIPTION - Hydrogen and methane are prepared by:    (A) pumping residual sludge generated in a sewage treatment process to a pre-treatment pond for thermal pre-treatment at 60-150 degrees C for 30 minutes;    (B) cooling pre-treated product to room temperature, pumping cooled product to a closed first fermentation tank for anaerobic fermentation at 35 degrees C for 10-50 hours to prepare hydrogen, and discharging 90% of the sludge to an adjusting pond and collecting the remaining 10% of the sludge in the first fermentation tank as seed sludge having a pH of 4-6;    (C) adding another batch of residual sludge to the adjusting pond having sludge at a ratio of 1:3, adjusting pH value to 6.5-7.5, and pumping the mixture to a closed second fermentation tank for anaerobic fermentation at 35?0C for 24-96 hours to prepare methane; and    (D) discharging 90% of the remaining sludge and collecting the remaining 10% in the second fermentation tank as seed sludge.    The first fermentation tank has gas outlet for collecting the hydrogen. The seed sludge comprises short-chain organic acids. The second fermentation tank has gas outlet for collecting the methane.    DESCRIPTION OF DRAWING(S) - The drawing is a schematic view of a method of preparing hydrogen and methane (Drawing includes non-English language text).